diff --git a/src/Darryldecode/Cart/Cart.php b/src/Darryldecode/Cart/Cart.php index 503dce7..834d7f7 100644 --- a/src/Darryldecode/Cart/Cart.php +++ b/src/Darryldecode/Cart/Cart.php @@ -620,9 +620,7 @@ public function getTotal() { $subTotal = $this->getSubTotal(false); - $newTotal = 0.00; - - $process = 0; + $conditionTotal = 0.00; $conditions = $this ->getConditions() @@ -636,15 +634,11 @@ public function getTotal() } $conditions - ->each(function (CartCondition $cond) use ($subTotal, &$newTotal, &$process) { - $toBeCalculated = ($process > 0) ? $newTotal : $subTotal; - - $newTotal = $cond->applyCondition($toBeCalculated); - - $process++; + ->each(function (CartCondition $cond) use ($subTotal, &$conditionTotal) { + $conditionTotal = $cond->applyCondition($subTotal); }); - return Helpers::formatValue($newTotal, $this->config['format_numbers'], $this->config); + return Helpers::formatValue($subTotal+$conditionTotal, $this->config['format_numbers'], $this->config); } /**