I currently have set up a query string that automatically adds a set amount of products to the users cart when they click a specific button. I already have everything set with with the FormKey() and this is working as expected.

Working - domain.com/checkout/cart/add/product/13/qty/6/

I can also in an entirely different URL apply a specific promo code to the shopping cart

Working - domain.com/checkout/cart/couponPost/coupon_code/PROMOCODE/

However, I am unable to do both at the same time. I would like to build one URL that adds specific products to the users cart and then applies the promotional code. I would expect this URL to work....

Does not work :( domain.com/checkout/cart/add/product/13/qty/6/couponPost/coupon_code/PROMOCODE/

But it does not. Is there any way to accomplish what I am looking for?


1 Answer 1


Interesting question.

You cannot simply pair up these URLs to form a combination of actions.

domain.com/checkout/cart/add/product/13/qty/6/ is actually calling the Mage_Checkout_CartController::addAction with the parameters product = 13 and qty = 6

Similarly, domain.com/checkout/cart/couponPost/coupon_code/PROMOCODE/ is actually calling Mage_Checkout_CartController::couponPostAction with the parameters coupon_code = PROMOCODE.

I hope that makes sense why you cannot simply pair up the two functions, there's no way for the URL you enter to resolve to a single place in the PHP code to actually process anything.

Now, if you want you can possibly create a new controller action called addProductWithCoupon or something like that by extending the checkout controller and defining your new action but that really seems overkill.

I'm not entirely sure on your use case here, if this product is always meant to come with this discount then you should look into catalog price rules.

  • Thanks for the in depth explanation...makes complete sense and yes extending the checkout controller would be overkill for what I am going for. I think I will just have to tackle this from a different angle Nov 19, 2015 at 20:41

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.