Access a community of over 900,000 Shopify Merchants and Partners and engage in meaningful conversations with your peers.
Hi.
Browsing across various posts, I've seen that people are updating the cart count using .html(cartcountvalue). However, this isn't a scalable solution since different Shopify themes have different names in their HTML tags.
Example, Shopify's default theme has an attribute called CartCount. However, in other themes, this name is different.
So, what would be the best possible way to update the cart count on a Shopify store without refreshing the page?
Hey Abhilash, Is this the same question as you asked here https://ecommerce.shopify.com/c/shopify-apis-and-technology/t/generic-approach-to-update-cart-count-... and Jason answered?
Essentially, there is not currently a consistently reliable and enforced way across all stores to apply updates to the cart count. One approach may be to look at targetting the majority of themes then if that fails fall back to using Jason's suggestion which was to provide instructions within the app.
Hey Dan, pardon me for this.
Yes, I'll do as you and Jason have suggested. Thanks.
Hi there,
I have the same issue. When I enter the website I don't see the cart count until I add another item in the cart. Is it possible to guide me and explain me where to pu Jason recommendation?
Thanks!
@Catherinalm each theme is different you'll get further by providing your store name,theme, and storefront password if locked.
If you made any changes to your theme try and old version and see if the problem is still there.
If you just recently got your theme contact that themes support if the cart count is bugged.
If you recently added an app then this problem happened contact that apps developers.
@sillycube wrote:Any update after 3 years? I still don't find a way to update cart without page refresh 😞
@sillycube The topic is not about updating carts, it's about changing cart count INDICATORS and that more than likely will NEVER be a standard interface for changing the cart count indicators for ALL themes per my previous post.
If you need to hydrate|update a /cart template on the frontend with the new state based on the cart contents use the sections rendering api, or just ajax and a custom template consuming /cart.json.