From 300d868640c850e1a125259a40816af9fac0da61 Mon Sep 17 00:00:00 2001 From: Patrick Date: Sat, 5 Feb 2022 19:05:26 +0100 Subject: [PATCH] Update CartItem.php --- src/CartItem.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/CartItem.php b/src/CartItem.php index 5851be9..9f316fd 100644 --- a/src/CartItem.php +++ b/src/CartItem.php @@ -226,8 +226,9 @@ class CartItem implements Arrayable, Jsonable /** * Create a new instance from a Buyable. */ - public static function fromBuyable(Buyable $item, int $qty = 1, CartItemOptions $options = new CartItemOptions([])) : self + public static function fromBuyable(Buyable $item, int $qty = 1, ?CartItemOptions $options = null) : self { + $options = $options ?: new CartItemOptions([]) return new self($item->getBuyableIdentifier($options), $item->getBuyableDescription($options), $item->getBuyablePrice($options), $qty, $item->getBuyableWeight($options), $options); }