How to get applied cart price rule in magento add to cart observer ?

  • Which observer event are you using.? Nov 16, 2018 at 7:13
  • @NagarajJuro i am using checkout_cart_product_add_after observer Nov 16, 2018 at 8:22

2 Answers 2


Try to getting the appliedRuleIds by calling the $quote from your $quoteItem


<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Event/etc/events.xsd">
    <event name="checkout_cart_product_add_after">
        <observer instance="Vendor\Module\Observer\ProcessAppliedRules" name="Vendor_Module::process_applied_rules"/>



namespace Vendor\Module\Observer;

use Magento\Framework\Event\Observer;
use Magento\Framework\Event\ObserverInterface;

class ProcessAppliedRules implements ObserverInterface
    public function execute(Observer $observer)
        /** @var $quoteItem \Magento\Quote\Model\Quote\Item */
        $quoteItem = $observer->getEvent()->getQuoteItem();
        $quote = $quoteItem->getQuote();

        $appliedRuleIds = $quote->getAppliedRuleIds();

        // Do some crazy stuff here

        return $this;

As the OP has asked in Magento 1 the login is similar as @Tuyen has posted the only thing I would like to add is you get the applied rule ids for each item using

$quoteItem = $observer->getEvent()->getQuoteItem();
$appliedRuleIdsOfItems = $quoteItem->getAppliedRuleIds();

and if you need for full quote use

$quote = $observer->getEvent()->getQuoteItem()->getQuote();
$appliedRuleIds = $quote->getAppliedRuleIds();

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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