Update Cart.php

This commit is contained in:
Patrick
2022-02-05 19:15:07 +01:00
committed by GitHub
parent 1df06502af
commit 3bbaadfea5

View File

@@ -134,7 +134,7 @@ class Cart
}
/* Also allow passing a Buyable instance, get data from the instance rather than parameters */
else if ($id instanceof Buyable) {
if (! is_int($nameOrQty)) {
if (! is_null($qtyOrOptions) && ! is_int($nameOrQty)) {
throw new InvalidArgumentException('$nameOrQty must be of int (quantity) when adding a Buyable instance');
}