5

I have installed Magento 1.8.0 and on localhost the cart is working correctly. I change the quantity of a product in the cart then I push the "Update cart" button and all works fine. I trasferred the site online and the cart quantity doesn't work anymore. As I change the quantity of a product and click the button the quantity remains the same. If I go back and try to add the same product to the cart, even if I specify a different quantity like 10 and not 1, in the cart only 1 item is added every time I click on "add to the cart" button and not 10 as specified. I cannot figure out where's the problem. I excluded my custom theme and rolled back to the default theme and the problem persist. I updated magento to 1.8.1 and the same problem.

No logs. Nothing.

8

In your theme directory

In your /app/design/frontend/yourthemepackage/default/template/checkout/cart.phtml file or /app/design/frontend/default/yourtheme/template/checkout/cart.phtml file

Just place on line 50 just after getUrl('checkout/cart/updatePost') ?>" method="post"> paste the below code

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

it will work fine now.

  • This code gets a hidden input element that just "makes the form work"! Awesome - this answer deserves more upvotes – Jimmery Dec 18 '15 at 16:40
  • Had the same problem with 1.9 - this fixed it. – Daniel Alexiuc Jul 11 '16 at 21:45
  • Perfect solution. I was needed to add formKeys to several places on website, and still found missing formKeys. Painful. – Marcos Pérez Gude Nov 9 '17 at 8:57

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.