Really struggling with this. I'm trying to see if the conditions of a 'Shopping Cart Price Rule' have been met directly on the 'View Cart' page. If so, I want to add a product automatically to the cart.

I have been trying different methods using:


with the rule ID being 18, then echoing to see if it worked, no such luck yet.

I'm trying to make it so I can at least see if the conditions have been met before I try to automatically add a product to the cart.

Something along the lines of:

if (product conditions have been met) {
automatically add product to cart

I have already seen this How to check if shopping cart price rule applied to quote, however that is showing rules that have already been applied, rather than rule that 'could' be applied.

Any help would be much appreciated.


2 Answers 2


You need to make a Observer.php file where you will be defining your rule. So when that particular product or group of product will be added to the cart,at that moment,the Observer.php will be called,will apply the rule if applicable.

I will be writing a blog on that and will be releasing it soon.For the time being,you better try to create a Observer.php file and define the rule there and see what happens next.

Note:For that you will have to change the config.xml file for that particular module.


You need to go to this path as given below-> Promotions->Shopping Cart Rules->(Click on the rule you defined)->Conditions And, you will get to know if any condition is defined for that particular rule or not.I am sharing the screenshot,refer to it.

Shopping Cart Rule Condition Section

  • Hi Arijit, I get that, and understand the conditions part which I have already set up, but I want to automatically add a product to the cart when those conditions have been met, rather than the customer having to add the product manually. In my actions, I have already set the product to be added as 100% off the price.
    – James Lane
    Feb 3, 2016 at 11:36

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.