Skip to content
infosoftix

WooCommerce Add to Cart Not Working? Causes and Fixes

WooCommerce Add to Cart button does nothing, spins forever or empties the cart? Check AJAX settings, caching, plugin and theme conflicts, product setup and security rules.

Written by Sanjoy BiswasFounder, Infosoftix · 20 years in software, 2,000+ projects

Updated

When the Add to Cart button stops working, a WooCommerce store stops selling, and it's often invisible to the owner, who is logged in and sees a different version of the site. The symptom varies: the button does nothing, the spinner never stops, the product appears in the cart and then vanishes, or the mini-cart doesn't update until the page is reloaded. Each symptom points to a different cause, so start by writing down exactly what happens, on which page, and for which products.

What happens when a shopper clicks Add to Cart in WooCommerce

How Add to Cart works

On shop and category pages, WooCommerce can add products without a page reload. The button sends a background request to the wc-ajax=add_to_cart endpoint, the server adds the item to the shopper's session, and WooCommerce returns updated cart fragments, the small pieces of HTML such as the mini-cart and the cart count. On single product pages, the button usually submits a normal form and the page reloads. Anything that breaks the background request, the session cookie or the fragments breaks the button.

Cause 1: The AJAX settings

In WooCommerce → Settings → Products, two options control the behaviour: Enable AJAX add to cart buttons on archives and Redirect to the cart page after successful addition. If a theme expects one and the setting says the other, the button can appear to do nothing. Variable products always need the shopper to choose options on the product page first, so their archive button says "Select options" instead.

Cause 2: Caching the cart

This is the most common cause of a cart that empties itself. Full-page caching, at the host, in a plugin or at a CDN, must never cache the cart, checkout and My account pages, and must not cache pages for visitors who have WooCommerce's cart cookies (woocommerce_items_in_cart, woocommerce_cart_hash and the session cookie). If cached pages are served to shoppers with a cart, they see someone else's empty cart. Most WooCommerce-aware cache plugins handle this, but custom CDN rules often don't.

Cause 3: A JavaScript error

One broken script can stop every script after it, including WooCommerce's. Open the browser's developer tools, go to the Console tab, reload the page and click the button. A red error naming a plugin or theme file is a strong lead. Script optimisation plugins that combine, defer or delay JavaScript are frequent culprits: exclude WooCommerce's scripts and jQuery from delay, then test again.

Checklist when WooCommerce Add to Cart fails

Cause 4: Theme template overrides

Themes can override WooCommerce templates such as the add-to-cart buttons. When WooCommerce updates and the theme's copy doesn't, the button can lose the attributes the scripts rely on. WooCommerce → Status lists outdated template overrides at the bottom of the report. Switching briefly to a default theme such as Storefront on a staging copy confirms whether the theme is involved.

Cause 5: Product setup

Some "broken" buttons are working as designed. A product with no price can't be purchased, so no button appears. An out-of-stock product, a variation that wasn't selected, a sold-individually product already in the cart, or a minimum or maximum quantity rule from a plugin will all block the add, usually with a notice at the top of the page that a theme may hide.

Cause 6: Security rules blocking the request

Firewall plugins, host security rules and CDN bot protection can block the background request to wc-ajax, especially for visitors from some countries or with unusual browsers. In the browser's Network tab, a blocked request shows a 403 status. Check your firewall logs around the time of a test click and allowlist the WooCommerce endpoint rather than turning protection off.

Block-based cart and checkout

Newer stores use the Cart and Checkout blocks, which rely on the Store API instead of the older endpoints. Plugins built only for the older shortcode cart may not work with the blocks. If problems started after switching, check each plugin's compatibility, or temporarily switch the cart page back to the classic shortcode to compare.

How to test it properly

  1. Log out, or use a private window: logged-in admins usually skip the cache.
  2. Test a simple product and a variable product, from both the shop page and the product page.
  3. Watch the Console and Network tabs while clicking.
  4. Repeat on a phone over mobile data, because CDN and firewall rules can treat it differently.

Example: the cart that emptied itself

Example, for illustration. A store adds a CDN with full-page caching to speed up the site. Shoppers can add products, but the cart is empty when they open it, and sales drop. The CDN cached the cart page and ignored WooCommerce's cookies. Adding bypass rules for the cart, checkout and My account pages, and for visitors with cart cookies, fixes it without losing the speed gain on other pages.

What to have ready before you contact us

  • What happens when you click, on which pages, and since when.
  • Recent changes: plugin updates, a new theme, cache or CDN settings.
  • A staging copy of the site, if you have one.
  • Admin access through a separate user account for us. Never share your own password.

Get it fixed

We fix WooCommerce cart and checkout problems as hourly custom development, $25–$49 per hour depending on the work; most Add to Cart fixes take a few hours. We find the cause on a staging copy, fix it, test on desktop and mobile, and explain what changed. If the button works but checkout is slow, see why WooCommerce checkout is slow. Book a call.

Frequently asked questions

Why does my WooCommerce cart empty itself?

Usually because the cart page or pages for shoppers with cart cookies are being cached. Exclude cart, checkout and My account, and bypass cache for visitors with WooCommerce cart cookies.

Why does the Add to Cart button spin forever?

The background request is failing or returning an error. Check the browser's Console and Network tabs for a JavaScript error or a blocked request.

Why is there no Add to Cart button on a product?

The product may have no price, be out of stock or be a variable product that needs options chosen first.

Can a plugin break Add to Cart?

Yes. Script optimisation, firewall and cart-related plugins are common causes. Test by disabling them one at a time on a staging copy.

Why does it work for me but not for customers?

Logged-in admins usually bypass the cache and some security rules. Test logged out, in a private window and on mobile data.

What are cart fragments?

Small pieces of HTML, like the mini-cart, that WooCommerce refreshes after an item is added so the page doesn't need to reload.

Do the Cart and Checkout blocks change anything?

They use the Store API, so plugins made only for the older shortcode cart may not work with them.

How much does fixing it cost?

It's hourly custom development at $25–$49 per hour; most Add to Cart fixes take a few hours.

Tell us what you need

Call, WhatsApp or send a message. We reply within a few hours, Saturday to Thursday.