Can’t update cart quantities after upgrade to Magento 1.8

Another issue which has cropped up on a number of clients’ sites after an upgrade to Magento 1.8 is that they can’t update cart quantities any more. The functionality still appears to be there – you change product quantities and hit the “update basket” button – but it doesn’t actually do anything.

If this is happening to you, the chances are that you’re using a custom template file for template/checkout/cart.phtml in your theme – with the recent upgrade a small change has been introduced to the base version of this file which, since you’re using a custom version, won’t be reflected in your page.

One approach is simply to delete the cart.phtml file, which forces Magento to fall back on the base file – but if you’ve got a custom version of that file the chances are you’ve made some changes to it, which would be wiped out if you went down this route.

The better approach is to add the updated lines to your own cart.phtml file – to fix the specific issue at hand there are two additions which need to be made :

Towards the top of the file, find the line :

<?php echo $this->getMessagesBlock()->getGroupedHtml() ?>

and after it add in this line :

<?php echo $this->getChildHtml('form_before') ?>

Shortly after that, look for the line :

<form action="<?php echo $this->getUrl('checkout/cart/updatePost') ?>" method="post">

and check that after it there is the following line :

<?php echo $this->getBlockHtml('formkey'); ?>

If not, add it in.

Then, further down the file, look for the code which outputs your “clear shopping cart” button – if you’ve not customised your installation, this should look something like this :

<button type="submit" name="update_cart_action" value="empty_cart" title="<?php echo $this->__('Clear Shopping Cart'); ?>" class="button btn-empty" id="empty_cart_button"><span><span><?php echo $this->__('Clear Shopping Cart'); ?></span></span></button>

Immediately after it, paste the following lines :

                            <!--[if lt IE 8]>
                            <input type="hidden" id="update_cart_action_container" />
                            <script type="text/javascript">
                                Event.observe(window, 'load', function()
                                    // Internet Explorer (lt 8) does not support value attribute in button elements
                                    $emptyCartButton = $('empty_cart_button');
                                    $cartActionContainer = $('update_cart_action_container');
                                    if ($emptyCartButton && $cartActionContainer) {
                                        Event.observe($emptyCartButton, 'click', function()
                                            $emptyCartButton.setAttribute('name', 'update_cart_action_temp');
                                            $cartActionContainer.setAttribute('name', 'update_cart_action');


Save the file, upload it to your theme’s template/checkout/ folder (remember to keep a backup of your original cart.phtml) and you should be good to go!


  • Die

    Hello, I am trying to solve this problem and I can not find a solution. I have seen all your steps and they do not solve the problem. I have Magento
    Could you help me?

  • Jane

    Amazing !! Thank you so much for taking the time to post this, I have been searching all day for this fix and your edits worked first time !!

    • Giles Bennett (author)


      You’re welcome.

      Kind regards,


  • Geo

    Hello, Im experiencing this issue but from updating magento to I tried to delete the file, but it didnt work, and to add the lines, but they all seem diferent in the new version file. Hope you can give me some help. thank you

    • Giles Bennett (author)


      If they all seem different, then you may not be editing the correct file…

      Kind regards,


  • Mirjam

    The checkout cart for me is properly working, but the mini cart (ajax) doesn’t update on my webshop.
    Do u know the solution for it. I would be so happy if it works. When I add a product it stays on zero.

    Friendly regards Mirjam.

  • Panjianom

    It works!
    Thank you so much!

  • Sean

    Thanks mate. Easy to follow and done the job perfectly. Cheers

  • MgWorx

    Hi, I have experienced this exact same issue on Magento 1.9. I have tried the fix you posted but it is not working. Can ou perhaps advise – thanks!

    • Giles (author)


      Are you sure that your amended template file is being picked up?

      Kind regards,


  • Jack

    Thanks, this works great!

  • Arjen

    I bow to you, this saved the day!

  • mister-eeee

    life saver!!! 🙂 Thanks sooo much!

  • Francoisd


    I’m on a Magento CE 1.7 with multisite configuration
    On a subdomain, my update button doesn’t work even with your code suggestion.
    On the main domain, it works without adding code ( in my case, missing getBlockHtml(‘formkey’); ?> in the 1.7)

    In my firebug, the POST Request /checkout/cart/updatePost/ as a 302 Moved temporarily status.

    Have you seen this case ?


    • Giles (author)


      Not to my knowledge. But the fix in this post is specifically for something which was added in 1.8, so isn’t relevant to 1.7.

      Kind regards,


  • Chris

    Thanks dude!
    You’ve saved me a lot of time.

  • Bob

    Thanks, fixed the problem!

  • Bethan

    Thank you! Quick question, my clear cart button is now working correctly but although the update cart button is working now too, the user is being taken back to the home page instead of staying on the cart. Any ideas? Thanks in advance.

    • Giles (author)


      Sounds a bit broken – the Continue Shopping button should take the user to the homepage, but not the update cart button. What’s the site’s URL?


  • Nick

    Just used this fix and it worked.

    For some reason the lines with update cart action were already there, just commented out. Uncommenting them fixed it!

    Thank you!

  • chamal

    thanks man you saved my day !!! keep writing

  • nick


  • marc

    thanks works 🙂

    • Giles (author)

      You’re welcome!


  • wendell alves

    Muito obrigado meu caro… salvou meu trabalho!!!!!!!!!!!!!!!!!!!!!!!!!!

    • Giles (author)

      De nada. 😉


  • ilia

    Thanks! this worked for – in my case only needed to add first 2 lines

  • Jesse

    Hello Giles,

    My site’s cart.phtml file has all of the line codes you provided, but still can’t update shopping cart qty.
    Any other thought?
    Thanks for your work.


    • Giles (author)


      Could be any number of things – drop us a line at and we’ll happily take a quick look for you without charge and see if anything jumps out.

      Kind regards,


    • Kenneth

      It thought I had em all until I actually saw that I was missing

      getBlockHtml(‘formkey’); ?>


      <form action="getUrl(‘checkout/cart/updatePost’) ?>” method=”post”>

  • Narayan

    Great article!! Thanks 🙂

  • josh

    This article actually fixed my problem where other articles and posts about the same issue did not.

    TIL – that buying magento themes even if they state they are 1.7 1.8 1.81 etc… compatible is a punt in the dark is not always true.

    Thank you Giles

  • hasitha1986

    Wow Cool, it is working thanks a lot…..

  • Inge

    Thanks a lot!!

    • Giles (author)


      You’re welcome!


  • AJ

    Thank you for this 🙂 🙂

    • Giles (author)


      You’re welcome. Nice profile pic!


  • kulai

    Thanks for this fix. It worked for me too!

    • Giles (author)


      You’re more than welcome.

      Kind regards,


  • sjoerd


    • sohail

      Thanks Brother…God Bless You a Lot….

  • smd

    Thank you, thats the solution! I experienced the same: customized cart, update to 1.8.1. and the cart update did not work any more – until now 😉

    • Giles (author)

      No problem – glad the post helped.


  • Marvin

    Great article, thank you!

    • Giles (author)


      You’re welcome – thanks for your comment!


Leave a Reply

Your email address will not be published. Required fields are marked *

Want to talk to us about your project?