Plugins Plugin hub Backup SEO Caching Security Forms WooCommerce Images Best backup plugins
Hosting Hosting directory Shared Managed Cloud India
Themes & builders Compare Rank Math vs Yoast
Tools All tools Hosting finder Plugin stack builder Cost calculator Salt generator Theme detector Who is hosting this? Speed test Headline analyzer robots.txt generator Redirect generator Uptime calculator Blog name generator
Best lists Best backup plugins Deals
Guides All guides Speed up WordPress Choose hosting Back up WordPress
How we test

Troubleshooting · Troubleshooting

How to Fix A Broken Add to Cart Button in WooCommerce

Short answer

The add to cart button fails when the product cannot be bought, a script error stops the click, or caching serves a page with no working cart session. Test in a private browser window while logged out first, because admins often bypass the cache. Then check stock and price, clear the cache, and run a plugin conflict test.

Key takeaways

  • Test as a guest in a private window, because admins often bypass the cache.
  • A missing button points at stock, price or product type, not at the theme.
  • Exclude the Cart, Checkout and My Account pages from every cache layer.
  • Troubleshooting Mode tests plugins and themes for your user only.
  • An outdated template override can break the product form that holds the button.

What do you see when you click add to cart?

The symptom you see points at the cause, so note it before you change anything.

What you seeCheck first
Button is missingStock, price, product type, catalogue settings
Button does nothingJavaScript error or plugin conflict
Button spins foreverBlocked request, firewall, or PHP error
Added message but cart is emptyCache, session or cookie problem
Works for admin, not customersGuest caching or security rule
Only variable products failVariation data or variation script

A missing button is a product problem. A button that clicks but does nothing is a script or request problem. A cart that stays empty after an “added” message is a cache or session problem.

Write down which products fail. If only one or two products fail, product data is more likely than a site-wide fault. If every product fails, the cause is site-wide.

How do you test the button the way a customer does?

Log out and test in a private browser window, because admins often bypass the cache.

Logged-in admins usually get a fresh page with a working session. Visitors get the cached copy, so a fault that hits only visitors points straight at caching.

Try a simple product first, then a variable product. Note whether the cart count in the header changes after each click.

Clear your browser cache before you start, so an old page cannot fool the test. Use a second browser or a phone if you have one, and test the same product there.

Can the product actually be bought?

Open the product and check stock, price and product type before you blame the theme.

A product with no price, no stock status, or a stock quantity of zero hides its button. An out-of-stock product shows no button by design, not by error.

Check the product type too. A variable product needs at least one variation saved with a price. A grouped or external product has no add to cart button of its own.

Product settings live at WooCommerce > Settings > Products, where you control inventory management and stock notifications. See WooCommerce's guide to configuring settings.

Is caching serving a stale page?

Clear every cache layer, then exclude the cart pages from caching for good.

Page caching plugins, host caches and CDNs can serve visitors a stored copy of the product page. That copy may hold cart fragments that belong to nobody, so the button looks fine and adds nothing.

Exclude the Cart, Checkout and My Account pages from every cache layer. WooCommerce's system status report lists those three pages with their page IDs, so you can check they point at real pages.

Purge the cache plugin, the host cache and the CDN after each change. Then retest as a guest in a private window. Our guide to LiteSpeed Cache settings for WooCommerce shows the exact exclusions for that plugin.

Is a script error blocking the click?

Open the browser console and look for a JavaScript error on the product page.

WooCommerce relies on browser scripts for parts of the add to cart flow. A script error earlier in the page can stop the cart script from running at all.

Common triggers are JavaScript minification, script combining, and delay JavaScript settings in an optimization plugin. Turn those settings off one at a time and retest.

With AJAX add to cart on, the click sends a request to ?wc-ajax=add_to_cart. Watch the Network tab in DevTools for that request. A 403 often means a security rule blocked it, while a 500 often means a PHP error.

Is a plugin or theme breaking the button?

Use Troubleshooting Mode to test with only WooCommerce active, without changing what visitors see.

The Health Check plugin page says Troubleshooting Mode gives you a clean session with all plugins disabled and a default theme, but only for your user. See Health Check & Troubleshooting.

Turn plugins back on one by one until the button breaks again. The Make WordPress Support handbook page on the Health Check plugin says this mode does not affect other visitors, so you can test on the live store.

If the button works with a default theme, your theme is the cause. WooCommerce's system status report recommends switching to the free Storefront theme for this test. If the button still fails, the fault is in a plugin or in WooCommerce itself.

Are your WordPress and site addresses matched?

Check Settings > General and make sure the two addresses match exactly.

WooCommerce's system status report shows the WP address (URL) and the Site address (URL) as separate fields. One is where the core files live, and the other is the address visitors type.

If one uses www and the other does not, or one uses http and the other uses https, the session cookie can land on the wrong host. The cart then never sticks, even though the button seems to work.

The developer handbook on editing wp-config.php says WP_SITEURL and WP_HOME hard-code these two values. If they are set there, fix them in wp-config.php, not in Settings.

Are your templates out of date?

Open WooCommerce > Status and scroll to the Templates section.

An outdated template override can break the product form that holds the button. The system status report shows which theme files override WooCommerce templates and whether each one is out of date.

Update the theme, or ask the theme author for a fixed override. Do not edit the override in the parent theme, because the next theme update will wipe the change.

Outdated WooCommerce, WordPress or plugin versions can also break the button. WordPress.org recommends PHP 8.3 or greater, so confirm your PHP version while you update. Our guide to updating WooCommerce safely shows the order to update in.

How do you confirm the fix worked?

Add a simple product and a variable product as a guest, then check the cart.

Both should land in the cart, and the header cart count should rise. Open the cart page and confirm the products, quantities and prices are right.

Test on a second browser or device too. A fix that works in one browser can still fail in another if the cache was only cleared in one place.

Leave the cart pages excluded from caching. If the button breaks again after the next plugin update, run the same guest test first. Our guide to WooCommerce settings explains the settings that affect the cart.

What mistakes should you avoid?

The most common mistake is testing only while logged in as admin.

  • Testing only while logged in, when the cache is bypassed for you.
  • Clearing one cache layer and leaving the host cache or CDN cache stale.
  • Editing the parent theme instead of a child theme to fix a template.
  • Turning off AJAX add to cart for good instead of fixing the blocked request.

Turning off AJAX add to cart is a useful test, not a fix. If the classic reload works, the AJAX request is blocked, so find the rule that blocks it.

When should you call your host or developer?

Call your host when the add to cart request returns a 403 or 500 error.

A 403 often comes from a firewall rule, and only the host can see which rule fired. A 500 often comes from a PHP error, and the host error log names the file.

Call a developer when the button works with a default theme but not with yours. The theme likely misses a WooCommerce hook or overrides a template badly.

Check your hosting resources before you call. Our guide to hosting resources for WooCommerce shows what a store needs. If the site runs out of PHP workers during busy hours, the cart request can time out for everyone.

Frequently asked questions

Why does add to cart work for me but not for customers?

Admins usually bypass the page cache, so you always get a fresh page with a working session. Visitors get the cached copy, which may hold a cart fragment that belongs to nobody. Always test in a private window while logged out, and exclude the Cart, Checkout and My Account pages from every cache layer.

Can a CDN break the add to cart button?

Yes, if the CDN caches the cart pages or the product pages with cart fragments. Exclude the Cart, Checkout and My Account pages from the CDN cache, and purge the CDN after each change. A CDN can also block the wc-ajax request with a security rule, so check its firewall log.

Do I need to clear the cache after every fix?

Yes, clear every layer after each fix: the cache plugin, the host cache and the CDN. Then retest as a guest in a private window. Clearing only one layer leaves stale pages in the others, so the button can look fixed to you and stay broken for visitors.

What if only variable products fail?

Check that each variation has a price and stock status, and that the attributes are saved on the product. A variable product with no saved variations keeps its button disabled. Clear the cache and retest, then check the browser console for a script error on the variation script.

Should I turn off AJAX add to cart?

Use it as a test only. Under WooCommerce > Settings > Products you can turn off AJAX add to cart buttons on archives. If the classic reload works, the AJAX request is blocked, so find the rule or script that blocks it instead of leaving AJAX off.

Can an outdated theme break the add to cart button?

Yes. A theme that misses a WooCommerce hook or overrides a template with an old copy can break the product form. Switch to the free Storefront theme for a test. If the button works there, the theme is the cause, so update it or ask its author for a fix.

Sources

  1. Configuring WooCommerce settings WooCommerce
  2. Understanding the WooCommerce System Status Report WooCommerce
  3. Health Check & Troubleshooting WordPress.org
  4. Troubleshooting using the Health Check Make WordPress Support
  5. FAQ Troubleshooting WordPress.org Documentation
  6. Editing wp-config.php WordPress Developer Resources

Is your product missing, or something out of date?

Tell us what to add or correct. We read every note and reply when we need a source. A message does not buy a ranking.

About the editors

WPLegible editors

Researched from the primary sources listed above and checked against our editorial rules. About the site · How we test