Initial assessment without passwords Quote before intervention One accountable specialist from start to finish

WooCommerce Critical

WooCommerce Add to Cart Not Working: AJAX, Validation and Product Data

Add to cart can fail in JavaScript, product validation, session creation or the server response. Capture the request and notice.

What matters first: The visible button is only the start of a chain. The browser sends product and variation data, WooCommerce validates it, creates session state and returns fragments or a redirect.

Find the first failing step in Add to cart

Whether the request is absent, rejected or successful without a visible cart update determines the repair path.

What to capture in the browser request

  • Watch the browser console and Network panel while clicking Add to cart.
  • Record product ID, variation attributes, quantity and response body.
  • Check WooCommerce notices and PHP logs for validation or fatal errors.
  • Test a simple product with optimisation and cache bypassed.

Validation, session and template causes

  • JavaScript conflict: The click handler or fragment update fails before the request.
  • Invalid variation: Required attributes or purchasable state do not match.
  • Session failure: Cookies or object cache prevent cart persistence.
  • Theme override: An outdated template sends wrong fields or markup.

Repair the failing layer, not the button

  1. Fix the first failing request or JavaScript error, not the button styling.
  2. Update or correct stale WooCommerce template overrides.
  3. Exclude cart fragments and AJAX endpoints from incompatible optimisation.
  4. Test simple, variable and out-of-stock products after the change.

JavaScript failure or invalid variation?

A JavaScript conflict normally stops or corrupts the request before WooCommerce can validate it; an invalid variation reaches WooCommerce but is rejected because attributes, stock or purchasable state do not match. The Network panel, response body and WooCommerce notices tell you which branch you are in. Fix that first failure instead of changing markup until the symptom disappears.

If Add to cart succeeds but the basket later empties, continue with the cart/session diagnostic. If the cart and payment complete but the customer lands on a broken confirmation, use the order-received troubleshooting flow. Those are downstream failures and should not be folded into the Add to cart diagnosis.

Do not bypass purchase validation

Do not force products into the cart by bypassing validation. Stock, variation and purchase rules protect order integrity.

Test products, fragments and totals after the fix

  • The intended products and variations enter the cart once.
  • Cart count, totals and mini-cart agree after refresh.
  • Validation still blocks invalid or unavailable combinations.

The fix is complete when simple and variable products enter the cart exactly once, unavailable combinations remain blocked, cart fragments and totals agree after refresh, and the same behaviour holds with normal optimisation and caching restored.

WP REPAIR INCIDENT STANDARD

Safe intervention sequence

Whether the request is absent, rejected or successful without a visible cart update determines the repair path.

WP RepairDiagnostic model
1Browser2Session3Gateway4Order
Follow the chain until you find the first point that stops behaving as expected.
  1. Watch the browser console and Network panel while clicking Add to cart.
  2. Record product ID, variation attributes, quantity and response body.
  3. Check WooCommerce notices and PHP logs for validation or fatal errors.
  4. Test a simple product with optimisation and cache bypassed.

What must be verified

  • The intended products and variations enter the cart once.
  • Cart count, totals and mini-cart agree after refresh.
  • Validation still blocks invalid or unavailable combinations.

ABOUT THIS SYMPTOM

Frequently asked questions about this guide.

The Add to Cart button visibly reacts but nothing ends up in the cart — where's the fault?+

This points toward the request being sent but rejected, rather than a JavaScript failure before the click registers. Check the Network panel response body and WooCommerce notices or PHP logs for a validation error, since invalid variation attributes or purchasable-state mismatches commonly produce exactly this behavior.

Is it safe to bypass validation to force a product into the cart when it won't add normally?+

No, this is explicitly warned against. Stock, variation and purchase rules exist to protect order integrity, so forcing a product past validation risks selling something that is out of stock or misconfigured rather than fixing the underlying problem.

How do I know if an outdated theme template is the cause instead of a plugin conflict?+

A theme override becomes suspect when a stale template file sends the wrong fields or markup for the current WooCommerce version, which you can confirm by comparing the actual submitted product ID, variation attributes and quantity against what the current template should send.

Does fixing the button's visual style ever actually solve this?+

No. The guide specifically frames the fix as addressing the first failing request or JavaScript error, not the button's styling, since a cosmetically working button gives no information about whether the underlying AJAX chain to validate and persist the cart item is functioning.

BEFORE YOU SEND THE REQUEST

Frequently asked questions.

Do you ask for passwords in the form?+

No. The public form never requests access. Secure credentials are requested only after the scope and quote are approved.

Who reviews the incident?+

The request goes to Jordi Ensenyat, founder of Code Barcelona and a WordPress specialist with more than 15 years of experience.

Is anything changed before the quote?+

No. Visible symptoms and scope are reviewed first. Intervention begins after approval and with a rollback path prepared.

Do you work internationally?+

Yes. WP Repair handles WordPress and WooCommerce incidents in English and Spanish through a remote service.

Assess my incident↗