Forcing all elements of a cart to update when quantity changes

Highlighted
New Member
4 0 0

I have an app that gives quantity discounts. When in my cart if I change quantities the discount does not always update:
When pressing the plus or minus button it doesn't update.
When tabbing or clicking out of the field the it doesn't update.
When pressing enter it does update.
If I refresh the cart it updates.

I've also noticed that on the mobile version there is an update cart button, pressing this button updates the discount.

My question is, is it possible to put some code in that will force the cart to refresh any time the quantity is changes (whether it is via the plus / minus buttons, tabbing out of the field or clicking out of it)?

I don't really have much coding knowledge but thought this might be possible.

Does anyone have any idea how to do this?

 

0 Likes
Highlighted
Excursionist
18 2 6

Hey @jmerrick, I've not seen your store, but it sounds like you don't have an asynchronous cart. With a regular cart, when you change information on the page, the system doesn't know what it's changed to until you press the Update button. With an asynchronous cart, your site sends data out regularly while you're on the page, so the system always knows what the quantities are and can apply discounts in real time. The app you've installed probably gets this data from Shopify.

It'd be like if you sent a letter. You can't see what the other person is writing back to you until they send the letter. But if you're both writing on a Google Doc, you can see it as they write.

I'm making some assumptions, but from your description this seems to be your issue. You can either convert your cart to an asynchronous cart (there could be a theme setting for this, or you may have to develop it using something like https://cartjs.org/), or show messaging on the cart page that asks users to Update their cart to see their discounts.

1 Like
Highlighted
New Member
4 0 0

JØhn,

Thanks for the info, that looks like it is along the lines of what I need.

 

Thanks,
Jake

0 Likes