on-internet
← Community

How can I update the Shopify cart count dynamically using JavaScript without refreshing the page?

Stack Overflow ·

I'm working on a Shopify theme and want to update the cart item count immediately after a customer adds a product using AJAX. Currently, the product is added to the cart successfully, but the cart count in the header doesn't update until the page is refreshed. What is the recommended way to update the cart count dynamically using Shopify's AJAX Cart API? I'm using JavaScript and Shopify Liquid.

Comments

Sign in or sign up to comment and upvote.

No comments yet.