-
-
Notifications
You must be signed in to change notification settings - Fork 27
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Cart Item Count not updating when navigating back #18
Comments
Hey @p6gb I think you take the Dawn theme as a starting point and it has its own JavaScript for updating the cart icon structure. |
Hey @EvgeniyMukhamedjanov Are you aware of any other components were Dawn and Liquid Ajax Cart JS scripts might interfere? Obviously there is the cart page. I'm thinking to basically have just a blank page there with the floating Liquid Ajax Cart JS always open. |
Well, actually I continue to have that problem for mobile.. Can you point me to where the update of the item count happens in the code so i can debug? Is there a load event listener or how does it work? |
I continued to have that issue but only when navigating back, especially on mobile devices. It seems that Safari mobile (probably Chrome aswell) serve the cached site for performance reasons and at least in my case there was not even a
|
Sorry for the late answer — didn't have chance to check GitHub. About mobile issue - most likely Dawn using two different element for mobile and desktop. So you need to remove the Dawn JavaScript from mobile version too. |
Additional HTML Elements are not the problem in my case, it lies with the handling of the However, this works only the first time navigating back and forward again. If you do the same thing twice, the
I've also found several answers suggesting that this behavior comes with having |
Anyways, I think adding something like the following would be a good idea (or is this taken care of otherwise?):
This should usually work. When I test e.g. here https://back-forward-cache-tester.glitch.me/?persistent_logs=1 the |
I finally could replicate the issue and understood why it happened. Thanks, @subject-matter I'll try to find a workaround for that and let you know. |
The issue is fixed in the v2.0.1 and 1.11.2. |
Expected Behavior
When adding an item to the cart and then navigating back (with browser button) the cart should display the number of items including the one that was just added.
Current Behavior
When running on the Shopify server, the cart displays the number of items as it was before adding the last item.
In local environment, the behavior is as expected.
Steps to Reproduce
Context (Environment)
The element that should display the updated count does have the required
data-ajax-cart-bind-state="cart.item_count"
property.Detailed Info
Shopify's Dawn theme is the basis and it's cart functionality has not (yet) been disabled. Maybe some interference is the reason for this behavior.
The text was updated successfully, but these errors were encountered: