diff --git a/classes/pricing/concerns/ApplyDiscounts.php b/classes/pricing/concerns/ApplyDiscounts.php index f8ed3b442..8bf51d7a6 100644 --- a/classes/pricing/concerns/ApplyDiscounts.php +++ b/classes/pricing/concerns/ApplyDiscounts.php @@ -66,16 +66,16 @@ public function applyDiscounts() ); continue; - } - - $value = $amount->value(); - $values = $value->allocate(...$products); - for ($i = 0; $i < count($values); $i++) { - $this->map['products'][$i]->addDiscount( - $values[$i]->getMinorAmount()->toInt(), - false, - false - ); + } else if (count($products) > 1) { + $value = $amount->value(); + $values = $value->allocate(...$products); + for ($i = 0; $i < count($values); $i++) { + $this->map['products'][$i]->addDiscount( + $values[$i]->getMinorAmount()->toInt(), + false, + false + ); + } } } elseif ($amount instanceof FactorValue) { foreach ($this->map['products'] as $product) { diff --git a/updates/version.yaml b/updates/version.yaml index cd140b874..cf4536a57 100644 --- a/updates/version.yaml +++ b/updates/version.yaml @@ -633,3 +633,5 @@ v3.5.15: - 'Fixed category-specific manual sort orders' v3.5.16: - 'Fixed category-specific manual sort orders' +v3.5.17: + - 'Fixed discount calculation for empty Carts'