I'm looking for place at code where shopping cart price rules are applied. Lets say, I've created a rule and when I add some product to shopping cart which match this rule, this rule will be applied and can change a price. I'm trying to explore module SalesRules, but without success. Maybe someone can give me a right direction?


The starting point for all salesrules are in the Observer:


There \Mage_SalesRule_Model_Validator::process() is called, where it is checked whether the rule should be applied:

if (!$this->_canProcessRule($rule, $address)) {

if (!$rule->getActions()->validate($item)) {

and afterwards the discounts are applied.

I hope this helps you on your way into the salesrules.

  • I am confused in your answer what should i write in my observer?i just want to check one flag from quote and if it is false then i don't want to apply rule.How can i achive this using observer? – MageLerner Jan 29 '19 at 12:46
  • Sorry but I don't understand the question. To get the quote you can call Mage::getSingleton('checkout/quote') and check for the flag. – Fabian Blechschmidt Jan 29 '19 at 15:33
  • I know that i can get quote flag like that but here i m asking that when my flag is false then i would like to stop applie rule on that quote. For that what should i do – MageLerner Jan 30 '19 at 5:40

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.