fix tests for cart conditions

This commit is contained in:
Joel Male
2024-09-03 21:07:58 +10:00
parent a269c188e4
commit 4d2efcdeae
2 changed files with 5 additions and 9 deletions
+4 -8
View File
@@ -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;
});
}