add handling for arrays

This commit is contained in:
Andrew Minion
2021-12-10 10:35:36 -06:00
parent 9a7d88fc35
commit 58f8648935

View File

@@ -70,7 +70,7 @@ class CartItem implements Arrayable, Jsonable
/** /**
* The options for this cart item. * The options for this cart item.
* *
* @var CartItemOptions * @var CartItemOptions|array
*/ */
public $options; public $options;
@@ -480,7 +480,9 @@ class CartItem implements Arrayable, Jsonable
'qty' => $this->qty, 'qty' => $this->qty,
'price' => $this->price, 'price' => $this->price,
'weight' => $this->weight, 'weight' => $this->weight,
'options' => $this->options->toArray(), 'options' => is_object($this->options)
? $this->options->toArray()
: $this->options,
'discount' => $this->discount, 'discount' => $this->discount,
'tax' => $this->tax, 'tax' => $this->tax,
'subtotal' => $this->subtotal, 'subtotal' => $this->subtotal,