Magento 1 – Auto Update Cart Quantity When Changing Quantity

cartmagento-1quantityshopping-cart

In the default cart of Magento, when the customer edit the quantity, he/she needs to press the button to update the quantity.

Is there a way that the cart update the quantity automatically when the user enter a other number in the quantity field?

Best Answer

First edit the cart template /app/design/frontend/{package}/{theme}/template/checkout/cart.phtml and add an id on the form element for easier access. Let's say you add 'id="cart-form"';

Now edit the templates that render the cart items:

  • app/design/frontend/{package}/{theme}/template/checkout/cart/item/default.phtml
  • app/design/frontend/{package}/{theme}/template/downloadable/checkout/cart/item/default.phtml

and on the <input> element with the name cart[<?php echo $_item->getId() ?>][qty] add this:

onchange="$('cart-form').submit()"

But I don't recommend doing this. It's really annoying for the users. (at least for me).