On this page
What this issue is
A shopper clicks add to cart. The product is added, or appears to be, but the cart count in the header stays at 0 or shows an old number. The mini cart drawer may also stay empty until the page is reloaded.
Most stores add items with a background request (called AJAX, a call the page makes without reloading). When the response comes back, the theme should update the badge. If that update fails, the cart and the badge disagree.
There are two different cases. In one, the item is in the cart and only the display is wrong. In the other, the add request failed and nothing was added. Both look the same to the shopper.
Why it costs you leads or sales
The cart count is the shopper's proof that the click worked. Without it, people click again and end up with duplicates, or decide the store is broken and leave. Others never find the cart because the badge gave no sign anything was added.
It can also hide a real failure. If the add request is failing, you lose sales and may also miss the add_to_cart event sent to GA4, Google Ads or Meta, which weakens your ad optimisation.
- Product pageShopper views the product
- Add to cart clickButton is pressed
- Cart count updateBadge stays at 0
- Open cartShopper unsure it worked
- CheckoutNever reached
The product page works, but the feedback step fails, so later steps are lost.
Example: illustrative numbers only, showing how a missing cart confirmation could reduce the share of shoppers who continue.
How to check if your site has it
Open a private window
Use a fresh session with no logged-in user and no existing cart, on desktop and on a phone.
Note the badge
Look at the cart icon before you click. It should show 0 or no number.
Add a product
Click add to cart without reloading the page. Watch the badge and the mini cart.
Open DevTools
Press F12, open the Network tab, filter by Fetch/XHR and repeat. Look for the add request (for example /cart/add.js on Shopify, ?wc-ajax=add_to_cart on WooCommerce). A 4xx or 5xx status means the add itself failed.
Reload the page
If the badge is right only after a reload, the item was added and the display refresh is broken or cached.
How to fix it
First work out which case you have: the add request failed, or the badge did not refresh. Then use the steps for your platform.
Exclude cart pages and cookies from caching
In your caching plugin, never cache /cart/, /checkout/ and /my-account/, and skip caching when the woocommerce_items_in_cart and woocommerce_cart_hash cookies are present.
Check cart fragments
WooCommerce refreshes the mini cart through the wc-ajax=get_refreshed_fragments request. If a performance plugin disables or delays cart fragments, turn that option off.
Rule out conflicts
Switch to a default theme or disable plugins one by one on a staging copy to find the one that breaks the update. Also check JavaScript minify, combine and delay settings.
Check the theme's cart code
Most themes re-render a cart count element after the add. Use Online Store > Themes > Edit code and look for the cart icon bubble section in your theme. If you customised it, compare with a fresh copy of the theme.
Test with apps disabled
Upsell, cart drawer and currency apps often override add to cart. Disable them one at a time and retest.
Preview the default theme
If the default theme works, the problem is in your theme edits or an app injecting code.
Look for scripts that interfere
In Preview mode, check whether a custom HTML tag overrides fetch or XMLHttpRequest, or reloads or modifies the cart element.
Pause suspect tags
Pause custom HTML tags one by one in a workspace and retest the add to cart click.
Check Ecommerce settings
Make sure the Cart element is on the page and its Cart Open settings are not set to never open. The cart quantity element updates automatically when the native Add to Cart button is used.
Remove custom code overrides
Custom scripts that hide or rebuild the cart button can stop the native update. Disable them and publish to test.
Check the store or funnel cart element
Open the page in the builder and confirm the cart element is on the page where the add button sits.
Remove custom JavaScript
Disable custom code blocks in the page settings and retest to see if they block the update.
Check the cart icon
In the Wix Editor, confirm the cart icon element is on every page where it should appear, including the header on mobile.
Review custom code
Check Settings > Custom code and any Velo code that touches the cart, and disable it to test.
Check the cart link
Confirm the cart button is enabled in the header settings of your template.
Review code injection
Remove custom code in Settings > Developer tools > Code injection and retest.
Update the badge from the server response
After a successful add request, set the badge from the returned cart data, not from a guess on the page. See the snippet below.
Send no-store headers for cart responses
Add Cache-Control: no-store to cart endpoints so a CDN or browser does not return old data.
async function addToCart(variantId) {
const res = await fetch('/cart/add.js', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({ items: [{ id: variantId, quantity: 1 }] })
});
if (!res.ok) { throw new Error('Add to cart failed: ' + res.status); }
const cart = await (await fetch('/cart.js', { cache: 'no-store' })).json();
document.querySelector('[data-cart-count]').textContent = cart.item_count;
}The click is registered, but the step that should refresh the cart count never completes.
How to confirm it's fixed
- In a private window, add a product and the badge changes immediately, without a reload
- The mini cart or drawer shows the same item and quantity
- The Network tab shows the add request returning a 200 status
- Adding a second item raises the count again
- Reloading the page keeps the same count
- It works on mobile and on desktop, as a logged-out visitor
How to prevent it happening again
This usually breaks after a change: a theme update, a new app, a caching or speed plugin setting, or a CDN rule. Test add to cart after every one of those changes, on a staging copy first where you can.
- Keep cart, checkout and account pages out of page caches and CDN caches
- Retest add to cart after theme, plugin or app updates
- Avoid delaying or combining cart JavaScript in speed settings
- Keep custom theme edits small and documented
- Run an automated check on the add to cart journey on a schedule
How FunnelGuard handles this
FunnelGuard detects this today. A robot visitor runs your add to cart journey on a schedule, from the EU or the US, clicks the button and asserts the cart count: it checks that the number changes after the click. If it does not, the failure is re-checked from a second region, and then one alert goes out by email, Slack, Teams, WhatsApp, webhook or PagerDuty, with a screenshot and a likely cause.
Test traffic is marked (utm_source=funnelguard, fg_test=1, an fg_test cookie and its own user agent) and it stops before payment unless your store's test mode is set up. The Free plan covers 1 site and 2 journeys with daily checks and no card needed, and paid plans have a 3-day free trial.
Questions people ask
Why is my cart count not updating after add to cart?
The usual causes are a cached page or cart fragment, a failed add request, or theme JavaScript that does not refresh the badge. Open DevTools, watch the Network tab when you click, and check whether the add request succeeds. If it does and the badge only changes after a reload, the problem is the display refresh or caching.
Why does my WooCommerce cart icon show 0 until I refresh?
Often a caching or performance plugin is serving an old version of the header, or cart fragments (wc-ajax=get_refreshed_fragments) are disabled or delayed. Exclude cart pages and the WooCommerce cart cookies from caching, and turn off any setting that disables cart fragments.
Why is my Shopify cart count not updating?
A theme edit or an app, such as a cart drawer or upsell app, is often overriding the add to cart code. Test the default theme with apps disabled, then re-enable apps one at a time to find the one that breaks the cart bubble update.
How do I know if the product was actually added to the cart?
Reload the page or open the cart page. If the item is there, the add worked and only the badge is wrong. If it is missing, check the Network tab for a failed add request (a 4xx or 5xx status) and the Console for JavaScript errors.
Can caching cause the cart count to be wrong?
Yes. If a page cache or CDN stores the header with a cart count, shoppers may see someone else's old number or a stale zero. Cart, checkout and account pages, and any cart endpoint, should be excluded from caching or sent with no-store headers.
Does a cart count bug affect ad tracking?
It can be a sign the add request failed, which means add_to_cart events may not fire either. Even when the add works, check in GA4 DebugView or each platform's test tool that the event still fires.
How can I monitor the cart count automatically?
FunnelGuard runs your add to cart journey on a schedule with a robot visitor and asserts that the cart count changes after the click. If it does not, you get one alert with a screenshot and a likely cause after a second-region recheck.
Related issues
- PRF-230Back button loses form/cart stateFix guide
- PRF-231Rage-click areas (elements that look clickable but aren't)Fix guide
- PRF-232Dead clicks on images/headings expected to linkFix guide
- PRF-219Submit button disabled with no explanationFix guide
- PRF-208Main CTA not visible without scrollingFix guide
- PRF-209No clear CTA on landing pageFix guide