diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 3ba70c4..dcf99be 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -13,7 +13,7 @@ jobs: strategy: fail-fast: true matrix: - php: ['8.1','8.2', '8.3'] + php: ['8.0', '8.1','8.2', '8.3', '8.4'] stability: [prefer-stable] steps: diff --git a/src/Cart.php b/src/Cart.php index c3147b0..435211c 100644 --- a/src/Cart.php +++ b/src/Cart.php @@ -345,17 +345,13 @@ public function getConditions(bool $active = false): CartConditionCollection if ($active) { return $conditions->filter(function (CartCondition $condition) { - $target = $condition->getTarget(); + $amount = $condition->getTarget() == 'subtotal' ? $this->getSubTotal(false) : $this->getTotal(); - $amount = $target == 'subtotal' ? $this->getSubTotal(false) : $this->getTotal(); - - return $condition->getMinimum() <= $amount; + return $condition->getMinimum() === null || $condition->getMinimum() <= $amount; })->filter(function (CartCondition $condition) { - $target = $condition->getTarget(); + $amount = $condition->getTarget() == 'subtotal' ? $this->getSubTotal(false) : $this->getTotal(); - $amount = $target == 'subtotal' ? $this->getSubTotal(false) : $this->getTotal(); - - return $condition->getMaximum() >= $amount; + return $condition->getMaximum() === null || $condition->getMaximum() >= $amount; }); }