Updated
The short answer
What the button does tells you where to look:
- Nothing happens — a JavaScript error, a script held back by an optimisation plugin, or a variable product with no option chosen;
- It spins and never finishes — the add-to-cart request failed: a PHP error, a firewall or a plugin conflict;
- It says added, but the cart is empty — caching, or a session cookie that isn't kept;
- The cart is right, but the header count isn't — cart fragments cached or not loading.
The browser console and the Network tab tell you which in a couple of minutes.
How Add to cart works
WooCommerce adds to the cart in two ways, and they break differently:
- On shop and category pages, if Enable AJAX add to cart buttons on archives is ticked under WooCommerce → Settings → Products, a script sends the product to
?wc-ajax=add_to_cartwithout reloading the page, then refreshes the mini-cart. - On a product page with a classic theme, the button submits a form and the page reloads with an “added to your cart” notice — unless a theme or plugin turns that into an AJAX request too. Block themes use their own Add to cart blocks.
The same settings page has Redirect to the cart page after successful addition: if it is ticked, shoppers go straight to the cart, which hides some of the problems below — and can look like the button “doesn't work” when the cart page itself is broken.
How to find the cause, step by step
- Reproduce it as a shopper. A private window, logged out — you probably bypass the cache as an admin, and your shoppers don't.
- Open the Console tab in the developer tools (right-click → Inspect) and press Add to cart. A red error names the file it came from, and the folder under
wp-content/plugins/orthemes/names whose it is. How to read these errors. - Open the Network tab and press it again. Look for
?wc-ajax=add_to_carton archives, or the POST to the product page on a product page. A500or HTML where JSON should be means a PHP error;403means a firewall or security plugin; a cached response with an old date means caching. - Check the logs. WooCommerce → Status → Logs keeps fatal errors, and the debug log keeps the rest — where WooCommerce keeps PHP errors.
- Isolate a conflict. With the Health Check & Troubleshooting plugin, test with only WooCommerce active and a default theme, for your browser alone. If it works, add the others back one by one.
JavaScript errors and script optimisation
AJAX add to cart, variation choosers and the mini-cart all depend on jQuery and WooCommerce's own scripts. An error in any script that runs first can stop them, and so can an optimisation plugin that delays, defers or combines them:
- Exclude
jquery, WooCommerce'sadd-to-cart,add-to-cart-variationandcart-fragmentsscripts from “delay JavaScript” and combine settings, then purge the cache. - Check custom code that changes the button — a quantity selector, a “buy now” button, a product add-ons plugin. These are common after a theme update.
Caching, sessions and cart fragments
WooCommerce remembers a guest's cart with a session cookie. When the product is added but the cart shows empty, something between the shopper and the store is losing it:
- Page cache. The cart, checkout and my-account pages must be excluded, and a visitor with a cart — WooCommerce sets
woocommerce_items_in_cartandwp_woocommerce_session_…cookies — should bypass the cache. Most caching plugins and hosts do this for WooCommerce; a CDN set to “cache everything” often doesn't. - Cookies not saved. A cookie banner set to block every cookie, including WooCommerce's necessary ones, or a CDN rule that strips
Set-Cookiefrom responses, means each page starts with a new, empty cart. - Two addresses for one store. If some links go to
www.and others don't, or tohttp://andhttps://, the cookie set on one isn't sent to the other. Redirect everything to one address and check Settings → General. - Cart fragments. The mini-cart and header count are refreshed by a request to
?wc-ajax=get_refreshed_fragments. Recent WooCommerce versions only load the fragments script where a mini-cart needs it, so a theme that expects it everywhere can show a stale count. Make sure the request is not cached and not blocked.
Variable products
On a variable product the button stays greyed out until the shopper picks every attribute. If it stays disabled or says the product is unavailable after choosing:
- The combination doesn't exist — a variation for those options was never created, or “Any” was not set where it should be.
- The variation has no price, isn't enabled, or is out of stock. A variation with an empty price can't be bought.
- Many variations. Above a threshold (30 by default), WooCommerce stops putting every variation in the page and asks the server for each combination. If that request fails or is cached, choosing options seems to do nothing.
- A swatches plugin that replaces the dropdowns but no longer talks to WooCommerce's variation script after an update.
When the product can't be bought
A missing button, or a notice that the product cannot be purchased, is often deliberate: no regular price, stock at zero with backorders off, Sold individually with one already in the cart, or a catalogue-mode or quote plugin. Check the product's General and Inventory tabs before chasing scripts.
Seeing it in StorePilot
A shopper whose Add to cart does nothing rarely tells you — they leave, and your traffic looks normal while sales drop. StorePilot shows you what they ran into:
- JavaScript and PHP errors grouped into issues, with how many visits by people they reached and where in the code they came from — theme, plugins or WordPress core.
- The steps before each error: the clicks, and the requests the page made to your own site with their status — WooCommerce's
wc-ajaxroute name is kept, so a failing add-to-cart or fragments request reads as itself. - Session recordings linked to an issue wherever the visit was recorded, and dead clicks and rage clicks marked in them — a button that changes nothing when pressed, or one pressed again and again. More in rage clicks and dead clicks.
Install the WordPress plugin — no theme or code changes — or see how error tracking works and read about error tracking in the docs.
Before you call it fixed
- Add to cart works logged out, on a phone and a desktop, from a category page and a product page.
- A variable product adds the chosen variation, and the header count updates without a reload.
- The cart still holds the product after moving to another page and back.
- The console is free of red errors on product and category pages.

