# WooCommerce add to cart not working

> Add to cart does nothing or leaves the cart empty? We trace the cache, cookie, theme or plugin fault and get your WooCommerce store selling again.

## Why does this happen?

Add to cart is two jobs: sending the product to WooCommerce, and remembering the cart on every page after that. When either job fails, customers see a button that does nothing, or a cart that empties itself. The fault is almost always in caching, the session cookie, the theme, a plugin script or the product’s own setup.

The causes we find most often:

- **Caching the cart.** A page cache, a host cache or a CDN stores one copy of a page and serves it to everyone. If the cart, checkout or account pages get cached, or the cache ignores WooCommerce’s cart cookies, customers see an old, empty cart. This is the classic “it works when I am logged in” fault.
- **A lost session cookie.** WooCommerce links each cart to a cookie. If the site address switches between www and non-www, or between http and https, the browser keeps the cookie for one address and the cart looks empty on the other.
- **A blocked request.** Add to cart sends a small background request, and on block themes that request goes to WooCommerce’s Store API under `/wp-json/wc/store/`. A security plugin that restricts the REST API for logged-out visitors, or a firewall or bot rule at the host or CDN, can block it. The button then spins or does nothing for customers but still works for you.
- **Theme template overrides.** Many themes ship their own copies of WooCommerce’s cart and add to cart templates. After a WooCommerce update those copies go out of date and can break the button, the mini cart or the variation form.
- **A JavaScript error.** One broken script on the page, often from a plugin or a page builder, can stop every script after it, including the one behind the button.
- **The product itself.** A product or variation with no price, no stock or a missing option cannot be bought, and WooCommerce refuses it, sometimes with a message that is easy to miss.

## Try this first

These checks are safe on a live store. None of them change how the store works for customers.

1. **Add one simple product and one variable product.** Do it in a private window while logged out, then open the cart page. Note exactly what happens: nothing, a spinner, an empty cart page, or an item that disappears on the next page. Try your phone too. That one note narrows the cause a lot.
2. **Check the product.** In wp-admin, open a failing product. Make sure it has a price and is in stock. For a variable product, open the Variations tab and check that the combination you chose has its own price and stock status. “Sorry, this product cannot be purchased.” usually means a missing price.
3. **Clear your caches.** Use your caching plugin’s purge button, and your host’s or CDN’s purge option if you have one, then test again in a fresh private window. If it works for a while and then breaks, caching is the prime suspect.
4. **Look at the status report.** Go to WooCommerce, Status. On the System status tab, scroll to the Templates section: lines that say a template “is out of date” point at the theme. On the Logs tab, open the newest log that starts with `fatal-errors`, if there is one.

Stop and hand it over if the fault started after an update, if the templates are out of date, or if a firewall or CDN is involved. Avoid deactivating plugins one by one on a live store, and avoid the Clear customer sessions tool: both can cost you sales while you test.

## Why does the cart icon show the item and then reset to zero?

The header cart count and the mini cart are refreshed by a separate script that asks WooCommerce what is in the cart. If that answer comes back from a cache, or the script never runs, the count shows the old empty value. Newer WooCommerce versions only load that refresh script where a mini cart needs it, so themes that relied on the older behaviour can show a count that never updates. The cart page itself may still be correct.

## Where does this end and checkout begin?

This fix covers everything up to a filled cart. If products reach the cart but the order fails at payment or when the customer places it, see the [checkout fix](https://boltpress.co/fix-wordpress/woocommerce-checkout-not-working/). If the button broke the moment you updated a plugin, theme or WooCommerce, see [site broken after an update](https://boltpress.co/fix-wordpress/site-broken-after-update/). If add to cart works but takes ages, the cause is usually speed, not a fault: see the [slow store fix](https://boltpress.co/fix-wordpress/slow-woocommerce-store/).

Not sure which one you have? Browse every fix on the [Fix WordPress](https://boltpress.co/fix-wordpress/) page.
