E-commerce

WooCommerce Add to Cart Not Working? Fixing the Button, Empty Carts, Mini Cart Not Updating and "Cannot Be Purchased" Errors

WooCommerce add to cart not working? Fix caching, cart fragments, JavaScript conflicts, stock and price settings, variable products and empty carts.

WooCommerce Add to Cart Not Working? Fixing the Button, Empty Carts, Mini Cart Not Updating and "Cannot Be Purchased" Errors
On this page
  1. WooCommerce add to cart not working: match the symptom
  2. 1. Exclude cart pages from caching
  3. 2. Check cart fragments and the mini cart
  4. 3. Look for JavaScript errors and plugin conflicts
  5. 4. Check WooCommerce settings
  6. 5. Check the product itself
  7. 6. Empty cart after adding: sessions and cookies
  8. 7. Outdated theme templates
  9. A safe test routine for a live store
  10. Stop it happening again
  11. Quick check: after the fix
  12. When to get help
  13. FAQs
Key takeaways
  • Most add to cart failures come from caching of cart pages or cart fragments, JavaScript conflicts from plugins or the theme, or product settings such as a missing price or stock.
  • Find the symptom first: button does nothing, cart stays empty, mini cart does not update, or the product says it cannot be purchased; each points to a different cause.
  • Test on a staging copy with plugins disabled one by one, exclude cart, checkout and my account pages from every cache layer, and check outdated template overrides.

If WooCommerce add to cart is not working, first check three things: that the cart, checkout and my account pages are excluded from every cache, that no JavaScript error appears in the browser console when you click the button, and that the product has a price, stock and (for variable products) a selected variation. These cover most cases of buttons that do nothing, carts that stay empty and mini carts that never update.

Below is a symptom-by-symptom fix list, followed by a safe testing routine you can use on a live Indian store without losing orders.

WooCommerce add to cart not working: match the symptom

What you seeMost likely cause
Button does nothing when clickedJavaScript error or conflict from a plugin, theme or minification
Product added, but cart page is emptyCart page cached, session cookie blocked, or www/https mismatch
Header mini cart count does not changeCart fragments disabled or cached by a speed plugin or CDN
Button missing on a productNo price, out of stock, or catalogue mode settings
"Please select some product options"Variable product with no variation chosen or broken variation data
"Sorry, this product cannot be purchased"Missing price, product not published, or a plugin restricting purchase
Works on desktop but not on mobileSeparate mobile cache, a mobile-only script, or an overlay covering the button

1. Exclude cart pages from caching

Cached pages are the most common cause. If the cart page is cached, visitors can see someone else's cart or an empty one. Check each cache layer:

  • Caching plugin such as LiteSpeed Cache, WP Rocket or W3 Total Cache: confirm the cart, checkout and my account pages are excluded. Most plugins detect WooCommerce pages, but custom cart page URLs or a translated slug can be missed.
  • Hosting cache on Hostinger, SiteGround, Cloudways and similar hosts: check the server cache settings and exclusions.
  • CDN or Cloudflare: a "cache everything" rule will cache the cart. Bypass cache for cart, checkout, my account and any request carrying WooCommerce cart or session cookies.

After changing exclusions, clear every cache layer in order; our guide to changes not showing on WordPress explains the clearing order. If you use a CDN, the CDN guide covers what to bypass.

2. Check cart fragments and the mini cart

WooCommerce uses a small script, cart fragments, to refresh the cart count and mini cart in the header without reloading the page. Speed plugins often disable it to save a request. If the mini cart stops updating after a speed change, re-enable cart fragments, at least on shop and product pages. Some themes provide their own mini cart that depends on this script.

Also check that the request WooCommerce uses to refresh fragments (the wc-ajax request) is not cached by the CDN or blocked by a firewall rule.

3. Look for JavaScript errors and plugin conflicts

Open the product page in Chrome, press F12, go to Console and click Add to cart. A red error usually names the file causing it. Common culprits:

  • JavaScript minification, combining or "delay JavaScript" features in speed plugins that break the order scripts load in.
  • Two plugins loading different versions of the same library.
  • Product add-on, wishlist, quick view, side cart or pincode checker plugins that hook into the add to cart button.
  • A page builder template that replaced the WooCommerce product form with a custom widget.

Turn off JavaScript optimisation first. If that fixes it, exclude WooCommerce scripts (and jQuery) from delay and combine settings rather than leaving optimisation off.

4. Check WooCommerce settings

  • Pages: under WooCommerce, then Settings, then Advanced, confirm the Cart and Checkout pages are set and published.
  • Cart behaviour: under WooCommerce, then Settings, then Products, check "Redirect to the cart page after successful addition" and "Enable AJAX add to cart buttons on archives". Turning AJAX off temporarily is a quick test: if adding works with a full page reload, the problem is JavaScript or fragments.
  • Cart block or shortcode: newer stores use the Cart block. Some older themes and plugins only work with the classic shortcode. If the cart displays oddly after an update, test the other version on staging.

5. Check the product itself

When the button is missing or a product "cannot be purchased", the issue is usually the product data:

  • No price. A simple product with an empty regular price has no add to cart button. Some stores do this deliberately for enquiry-only items.
  • Stock. If stock management is on and stock is zero with backorders off, the product is out of stock. See WooCommerce inventory and stock management.
  • Variable products. Each variation needs its own price and stock status, and must be enabled. A variation with no price makes that option unavailable. Our product variations guide covers the setup.
  • Catalogue or enquiry plugins that hide the button for some users or categories.
  • Visibility and status: draft, private or scheduled products cannot be bought by customers.

6. Empty cart after adding: sessions and cookies

If the notice says the product was added but the cart is empty, WooCommerce cannot keep the session:

  • Make sure the site uses one address. If some links go to http or to the non-www version, the cookie set on one version is not read on the other. Fix the WordPress Address and Site Address settings and redirect everything to one https version.
  • Check that a cookie consent tool is not blocking WooCommerce's essential cookies. Session and cart cookies are needed for the store to work.
  • Look at the database: a crashed sessions table, or a host that has run out of database space, can stop sessions saving.
  • Security plugins or a web application firewall can block the AJAX request. Check their logs for blocked admin-ajax or wc-ajax requests.

7. Outdated theme templates

Go to WooCommerce, then Status, and scroll to Templates. If your theme overrides WooCommerce templates and they are marked outdated, an old cart or product template may not match the current WooCommerce code. Update the theme or ask your developer to update the overrides in the child theme.

A safe test routine for a live store

  1. Take a full backup, including the database.
  2. Create a staging copy if your host offers one, and do the testing there.
  3. Switch to a default theme such as Storefront on staging and test add to cart.
  4. Deactivate plugins one by one, starting with speed, cart, checkout and product add-on plugins, testing after each.
  5. When you find the cause, fix the setting or replace the plugin, then apply the same change on the live store.
  6. Place a real test order through the payment gateway, including UPI and COD if you offer them.

If checkout also fails after adding to cart, continue with the WooCommerce checkout troubleshooting guide. For the wider list of errors and their first checks, see common WordPress errors and fixes.

Stop it happening again

  • Test add to cart, cart, checkout and payment after every plugin or theme update.
  • Make speed changes on staging first, because aggressive optimisation is a frequent cause.
  • Keep a simple weekly check in your WooCommerce maintenance checklist.
  • When tuning performance, follow a store-safe approach such as our WooCommerce speed optimisation guide.

Quick check: after the fix

  1. Add a product to the cart in a private window on a phone.
  2. Check your cache plugin excludes the cart and checkout pages.
  3. Open Chrome DevTools (F12) Console and check for JavaScript errors.

When to get help

Every hour the add to cart button fails costs sales, especially during festival offers. If you cannot find the conflict quickly, our WooCommerce developer service can diagnose and fix it on a staging copy first, and our WordPress maintenance plans include tested updates so the store keeps selling. You can also send the details through the contact form.

FAQs

Why is my WooCommerce add to cart button not working?

The usual causes are cached cart pages, a JavaScript conflict from a plugin or speed optimisation, or product data such as a missing price, zero stock or an incomplete variation. Check the browser console and your cache exclusions first.

Why is my WooCommerce cart empty after adding a product?

The cart page may be cached, the session cookie may be blocked, or the site may be switching between www and non-www or http and https. Use one https address and exclude cart pages from caching.

Why is the WooCommerce mini cart not updating?

Cart fragments are usually disabled by a speed plugin or the fragment request is cached by a CDN. Re-enable fragments and bypass cache for that request.

Why does WooCommerce say "Sorry, this product cannot be purchased"?

The product or variation has no price, is not published, or a plugin is restricting purchase. Check the product's price, status and any catalogue or membership plugins.

Why is the add to cart button missing in WooCommerce?

Products without a price, out-of-stock products with backorders off, and products hidden by catalogue mode plugins do not show the button. Some themes also hide it on shop pages.

Can a caching plugin break WooCommerce add to cart?

Yes. Page caching on cart and checkout pages and JavaScript delay or combine features are among the most common causes. Exclude WooCommerce pages and scripts from those features.

Need help with your website?

I'm a freelance WordPress developer building fast, SEO-friendly websites since 2020. Tell me what you need and I'll reply with a plan and a fixed quote, usually within 24 hours.

Found this useful? Share it:
Contact

Let's build your next website

Available for freelance projects, agency white-label work and long-term maintenance. Feel free to pass this along to your team or company.

I reply within 24 hours, usually the same day. Your details are emailed to me, then WhatsApp opens so we can chat right away.

Chat now