🔥 Just Launched! Werra Premium Template for HyväSee it in Action

How to Check Which Shopping Cart Rule is Applied to Cart in Magento

By Jignesh ParmarUpdated on May 21, 2025 1 min read

The default Magento allows the admin to add shopping cart price rules.

He can offer coupon codes to avail the discounts.

However, sometimes you may want to set conditions based on which discounts are offered.

For example, the admin wants to offer a specific payment method only for certain scenarios.

To implement this, the admin needs to check which shopping cart rule is applied to cart in Magento.

The below solution can be used for the same:

Method to Check Which Shopping Cart Rule is Applied to Cart in Magento:

Add the below code.

$appliedRuleIds = Mage::getSingleton('checkout/session')->getQuote()->getAppliedRuleIds();
$appliedRuleIds = explode(',', $appliedRuleIds);
print_r($appliedRuleIds);

By adding this code, you will be able to check which shopping cart price rule has applied to quote.

That’s it.

Thank you.

Jignesh Parmar Full Image
Article byJignesh Parmar

An expert in his field, Jignesh is the team leader at Meetanshi and a certified Magento developer. His passion for Magento has inspired others in the team too. Apart from work, he is a cricket lover.