Skip to content

Commit b587036

Browse files
committed
Merge remote-tracking branch 'l3/ACP2E-2377' into Tier4-PR-Delivery-12-1-23
2 parents e712426 + 92d7b12 commit b587036

File tree

2 files changed

+14
-8
lines changed

2 files changed

+14
-8
lines changed

app/code/Magento/SalesRule/Model/RulesApplier.php

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -223,16 +223,22 @@ protected function applyRule($item, $rule, $address, $couponCode)
223223
{
224224
if ($item->getChildren() && $item->isChildrenCalculated()) {
225225
$cloneItem = clone $item;
226-
/**
227-
* validate without children
228-
*/
229-
$applyAll = $rule->getActions()->validate($cloneItem);
226+
227+
$applyToChildren = false;
230228
foreach ($item->getChildren() as $childItem) {
231-
if ($applyAll || $rule->getActions()->validate($childItem)) {
229+
if ($rule->getActions()->validate($childItem)) {
232230
$discountData = $this->getDiscountData($childItem, $rule, $address);
233231
$this->setDiscountData($discountData, $childItem);
232+
$applyToChildren = true;
234233
}
235234
}
235+
/**
236+
* validate without children
237+
*/
238+
if (!$applyToChildren && $rule->getActions()->validate($cloneItem)) {
239+
$discountData = $this->getDiscountData($item, $rule, $address);
240+
$this->setDiscountData($discountData, $item);
241+
}
236242
} else {
237243
$discountData = $this->getDiscountData($item, $rule, $address);
238244
$this->setDiscountData($discountData, $item);

dev/tests/integration/testsuite/Magento/SalesRule/Model/Quote/DiscountTest.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -190,9 +190,9 @@ public function bundleProductWithDynamicPriceAndCartPriceRuleDataProvider(): arr
190190
[
191191
'bundle_cc',
192192
[
193-
'bundle_product_with_dynamic_price-simple1-simple2' => 0,
194-
'simple1' => 3,
195-
'simple2' => 7.99,
193+
'bundle_product_with_dynamic_price-simple1-simple2' => 10.99,
194+
'simple1' => 0,
195+
'simple2' => 0,
196196
],
197197
-10.99
198198
],

0 commit comments

Comments
 (0)