I am trying to create extension that add coupon code (Ajax) to one page checkout page last step. See http://www.lelandcope.com/2012/04/how-to-create-an-ajax-coupon-discount-code-box-in-magento/

Following code of CartController customcouponPostAction() which applies coupon code. its works fine

        $this->_getQuote()->setCouponCode(strlen($couponCode) ? $couponCode : '')

Shipping and handling charges calculation work fine as per table rate but when another Shopping Cart Price Rule which is free shipping above $15 (See http://www.phpro.be/news/configuring-shopping-cart-price-rules-magento-free-shipping) is also valid then shipping charge not become zero its still same as table rate.

Same scenario works like charm in cart page.

What am I missing?

  • If commented second line $this->_getQuote()->getShippingAddress()->collectShippingRates(); from above code the ajax response didn't reflect correct Shipping and handling charges even as per table rate. but if refresh page its show correct Shipping and handling charges.
    – Sandesh
    Commented Jan 9, 2014 at 15:15

1 Answer 1


A coupon code that enables 'Free shipping' does not automatically set the shipping price to zero. It just puts the 'Free shipping' in the shipping methods list for the customer to select.
I bet that if you refresh the checkout page after entering a valid coupon and go through all the steps again, in the shipping method step you should see the 'Free shipping' option available.

  • Yes indeed after refresh its show correct shipping charges but If I check ajax response, shipping charges are of as per table rate not as per free shipping sales rule if applicable.
    – Sandesh
    Commented Jan 9, 2014 at 15:05
  • How can make sure the free shipping is really applied if we have a coupon code that enables "free shipping"?? So it sets the shipping price to zero. This is very confusing!
    – Peanuts
    Commented Sep 22, 2020 at 15:46

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.