From fbb271b9dfcc382dcd29bb340223430e74c2b789 Mon Sep 17 00:00:00 2001 From: Oscar S Kolsrud <30559109+OscarKolsrud@users.noreply.github.com> Date: Sun, 5 Jul 2020 00:09:43 +0200 Subject: [PATCH] Update Cart.php Fixed a bug where 0 is passed as the taxrate to the Cart:add facade resulting in it not evaluating right since '0' is not true in a if statement. Changed therefore the comparison to isset() so it rather checks if there is passed a taxrate of some kind. Also added in the if statement a simple check to see if the taxrate is numeric, and if not default to the one in the config --- src/Cart.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Cart.php b/src/Cart.php index 12f7a463..cc254902 100644 --- a/src/Cart.php +++ b/src/Cart.php @@ -487,7 +487,7 @@ private function createCartItem($id, $name, $qty, $price, array $options, $taxra $cartItem->setQuantity($qty); } - if($taxrate) { + if(isset($taxrate) && is_numeric($taxrate)) { $cartItem->setTaxRate($taxrate); } else { $cartItem->setTaxRate(config('cart.tax'));