Given this design http://cl.ly/image/2J2k0p2f451Z where the user updates the quantity and clicks the "update" link/button, how do I go about updating the individual item quantity without actually submitting the cart and placing the order? I assume some hacky JavaScript can take care of it, but it seems like there should be a server side process for this.

1 Answer 1


The easiest way would be to add <input type="submit" name="update_cart" value="Update Cart" /> to your template and then add a bit of jQuery to bind the update link to the newly created update button (which you would want to hide to keep your current design).

As long as your submit button isn't called submit, commit (both of which submit the order), empty_cart (which empties the cart) or next (which updates the cart and redirects the customer to the url specified in your next_url parameter), Store will simply update the cart quantities and redirect you to the current page.

This allows you to have both "Continue to Checkout" and "Update Totals" buttons on the same form, which both update the cart but redirect the customer to different locations. This can be seen in the checkout.html example template which ships with Store:

<div class="form-actions">
    <input type="submit" name="update_cart" value="Update Totals" class="btn" />
    <input type="submit" name="empty_cart" value="Empty Cart" class="btn btn-danger" />
    <input type="submit" name="next" value="Continue to Billing Details" class="btn btn-primary" />
  • That did it. I see the docs for update_cart, but they were not near the Updating Quantities section, which could benefit from just adding the update_cart button to the example code hint hint Adrian. Thanks Justin! Commented Jan 30, 2013 at 19:31
  • To clarify, as long as your submit button isn't called submit, commit, or next, it will update the cart and return you to the current page (so update_cart works, but it doesn't actually need to be called that). I'll try to improve the documentation. Did you take a look at the sample templates? Commented Jan 31, 2013 at 3:57
  • I've edited Justin's answer to clarify the options you have for updating/submitting the cart. Commented Jan 31, 2013 at 4:05

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.