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.

What this symptom actually tells you

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

Capture evidence before changing anything

  • 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.

Most common 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.

Safe diagnostic and repair sequence

  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.

How to choose between the likely causes

Do not treat JavaScript conflict and Invalid variation as interchangeable. The click handler or fragment update fails before the request. By contrast, required attributes or purchasable state do not match. Use two checks to separate them: Watch the browser console and Network panel while clicking Add to cart; and record product ID, variation attributes, quantity and response body. Those observations usually show whether the next safe move is to fix the first failing request or JavaScript error, not the button styling or to preserve the current state and widen the investigation.

On a live store, reproduce the issue with a controlled test order and follow the same payment, stock, tax and notification path used by customers. Avoid changing several checkout components at once because that changes the application state and can obscure the original sequence of events needed to attribute the failure. Record the exact timestamp, affected URL or transaction, last known good state and every change made during diagnosis. That handover is often what separates a repeatable repair from a temporary disappearance of the symptom.

What not to do

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

How to verify the repair

  • 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.

A visible symptom disappearing is not enough. Close the incident only when the original failing action, the surrounding business journey and the relevant logs all agree that the fault is gone.

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