1

I want to apply my catalog promotion price rule for products having tier price as well. Current magento functionality only checks the price minimum value and displays the least among the both but I need the percentage rule amount discounted on tier price too.

  • Did you manage to solve your issue with the accepted answer? Can you please share the code? – Seb33300 Feb 11 at 2:51
2

Native magento doesn't support applying catalog promotion rule on tier prices and special prices but we can achieve this by extending some of the core files in magento. You can find the _applyTierPrice() method in path

\vendor\magento\module-catalog\Model\Product\Type\Price.php


protected function _applyTierPrice($product, $qty, $finalPrice)
    {
        if ($qty === null) {
            return $finalPrice;
        }
        $tierPrice = $product->getTierPrice($qty);
        if (is_numeric($tierPrice)) {
            $finalPrice = min($finalPrice, $tierPrice);
        }
        return $finalPrice;
    }

and in this file down you can get the promotional rule applied price in method calculatePrice() around line no 578 like and check for the min value.

$rulePrice = $this->_ruleFactory->create()->getRulePrice($date, $wId, $gId, $productId);

The rule factory is in constructor like \Magento\CatalogRule\Model\ResourceModel\RuleFactory $ruleFactory,`

you can also refer the calcProductPriceRule() in the vendor\magento\module-catalog-rule\Model\Rule.php to get the promo price of product and then comparing the values you can return your desired value to final price.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.