Skip to content

Commit db407bd

Browse files
committed
fix #3928 line item sale price calculation and discount “stop processing”
1 parent 8deed2b commit db407bd

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

CHANGELOG.md

+4
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
# Release Notes for Craft Commerce
22

3+
## Unreleased
4+
5+
- Fixed a bug where a line item’s sale price could be incorrectly calculated. ([#3928](https://github.com/craftcms/commerce/issues/3928))
6+
37
## 4.8.1.2 - 2025-02-10
48

59
- Fixed a bug where carts’ adjustment totals could be calculated incorrectly. ([#3888](https://github.com/craftcms/commerce/issues/3888))

src/models/LineItem.php

+6
Original file line numberDiff line numberDiff line change
@@ -610,10 +610,16 @@ public function populateFromPurchasable(PurchasableInterface $purchasable): void
610610
$ignoreSales = false;
611611
foreach (Plugin::getInstance()->getDiscounts()->getAllActiveDiscounts($this->getOrder()) as $discount) {
612612
if (Plugin::getInstance()->getDiscounts()->matchLineItem($this, $discount, true)) {
613+
// Break if matched discount is set to ignore sales.
613614
$ignoreSales = $discount->ignoreSales;
614615
if ($ignoreSales) {
615616
break;
616617
}
618+
619+
// Break if matched discount is set to not apply any subsequent discounts.
620+
if ($discount->stopProcessing) {
621+
break;
622+
}
617623
}
618624
}
619625

0 commit comments

Comments
 (0)