Skip to content

Commit 1f04a2f

Browse files
committed
ACP2E-2376: avoid double calculation for configurable and child product while applying discount for configurable
1 parent 40842d3 commit 1f04a2f

File tree

1 file changed

+4
-12
lines changed

1 file changed

+4
-12
lines changed

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

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,6 @@
77
namespace Magento\SalesRule\Model;
88

99
use Laminas\Validator\ValidatorInterface;
10-
use Magento\Catalog\Model\Product\Type;
11-
use Magento\ConfigurableProduct\Model\Product\Type\Configurable;
1210
use Magento\Framework\App\ObjectManager;
1311
use Magento\Framework\ObjectManager\ResetAfterRequestInterface;
1412
use Magento\Quote\Model\Quote;
@@ -513,16 +511,10 @@ public function initTotals($items, Address $address)
513511
*/
514512
private function isValidItemForRule(AbstractItem $item, Rule $rule)
515513
{
516-
if ($item->getProductType() === Type::TYPE_SIMPLE && $item->getParentItemId() != null
517-
&& $item->getParentItem()->getProductType() === Configurable::TYPE_CODE) {
518-
return false;
519-
}
520-
521-
if (($item->getHasChildren() || $item->getChildren()) && $item->isChildrenCalculated()) {
522-
return false;
523-
}
524-
525-
if ($item->getNoDiscount()) {
514+
if ($item->getParentItem() && $item->getParentItem()->getProductType() === 'configurable'
515+
|| (($item->getHasChildren() || $item->getChildren()) && $item->isChildrenCalculated())
516+
|| $item->getNoDiscount()
517+
) {
526518
return false;
527519
}
528520

0 commit comments

Comments
 (0)