End-users are the ultimate test subjects...

I'm noticing a trend with a small percentage of users in my store but still enough to lead to customer service calls when they can't solve the problem on their own. They are not hitting "update quantity" in the shopping cart before proceeding to checkout. The majority of users get it but I'm trying to completely side-step the phone calls by just having it automatically update the quantity THEN proceed to checkout.

The HTML containing the JS that triggers the update:

<a href="javascript:void(0);" class="update" onclick="return updateCart();">update</a>

I would like this event to happen when they hit Proceed to Checkout. Processing the onclick event returns Illegal return statement and the href link alone returns Undefined. Ideas?

  • What theme are you using? Default in CE-1.7 submits the entire cart when you click update, it doesn't use javascript to update it, and the proceed to checkout buttons use js to change the window location
    – Richard
    Commented May 28, 2014 at 15:24
  • Custom theme in and I wasn't the developer that originally created it. This behavior seems correct though: You hit "update" and it modifies your totals and reflects the quantity after the page refreshes.
    – sparecycle
    Commented May 28, 2014 at 15:34
  • When you said "processing the onclick event" did you mean adding that onclick to the proceed to checkout button? void(0) is undefined, it's just to stop the hyperlink actually linking anywhere, you'll have to dig into updateCart() to see what it returns, it looks ok to me, but I haven't used onclick in a long time. Assuming everything 'works' despite this then the laziest thing you could do would be to add /alter a link <a href="javascript:void(0);" onclick="updateCart();window.location=https://your.domain.name/checkout/onepage/">proceed to checkout</a>
    – Richard
    Commented May 28, 2014 at 15:38
  • Thank you Richard, that clears up a few questions and will probably help me solve it. The issue though is that this small group of troubled users aren't actually clicking "Update Cart", they change the quantity then hit "Proceed to Checkout". I need to ensure I capture their inventory changes even if the user happens to not apply the changes.
    – sparecycle
    Commented May 28, 2014 at 15:48

1 Answer 1


you can write your cart update code in controller_action_predispatch_checkout_onepage_index event.

this event is dispatched when proceed to checkout button is clicked.

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.