From 58f8648935e4afbfe5d5dae05e0344e83def74e0 Mon Sep 17 00:00:00 2001 From: Andrew Minion Date: Fri, 10 Dec 2021 10:35:36 -0600 Subject: [PATCH] add handling for arrays --- src/CartItem.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/CartItem.php b/src/CartItem.php index ed5e538..3c9361e 100644 --- a/src/CartItem.php +++ b/src/CartItem.php @@ -70,7 +70,7 @@ class CartItem implements Arrayable, Jsonable /** * The options for this cart item. * - * @var CartItemOptions + * @var CartItemOptions|array */ public $options; @@ -480,7 +480,9 @@ class CartItem implements Arrayable, Jsonable 'qty' => $this->qty, 'price' => $this->price, 'weight' => $this->weight, - 'options' => $this->options->toArray(), + 'options' => is_object($this->options) + ? $this->options->toArray() + : $this->options, 'discount' => $this->discount, 'tax' => $this->tax, 'subtotal' => $this->subtotal,