How to Fix WordPress Cannot Modify Header Information Error
This error means PHP output was sent before HTTP headers; fixing it requires removing…
WooCommerce Add to Cart Button Not Working
When you click the Add to Cart button on a WooCommerce product page and nothing happens — no item appears in the cart, the page just reloads blankly, or a spinner appears and freezes — that is this error. It is one of the most disruptive WooCommerce issues because your store looks completely normal but the single most important customer action silently fails.
WooCommerce uses JavaScript and AJAX to add items to the cart without requiring a full page reload. When something interferes with that AJAX request — a plugin, a theme, or a caching layer — the button loses its functionality entirely. The button still renders on screen, which is why this bug is so confusing to diagnose.
The good news is that this is almost never a WooCommerce core bug. It is nearly always caused by something in your specific environment, which means you can fix it by isolating the conflict.
You should see: Either no errors (JavaScript is not the issue) or a file path pointing to the conflicting plugin or theme script.
You should see: The product page loads fresh with no cached version. If the button now works, stale caching was the entire problem.
You should see: A “Settings saved” notice. Test the Add to Cart button again immediately after.
You should see: If the button works in Storefront, your active theme is the conflict. Contact the theme developer or check for a WooCommerce compatibility update.
You should see: The last plugin you activated before the button broke is your conflict. Disable it or contact its developer for a WooCommerce-compatible version.
You should see: No missing data warnings in the Product Data panel, and the Add to Cart button becomes fully functional on the frontend.
// Remove this line if it exists — it kills WooCommerce cart functionality
wp_deregister_script('jquery');
You should see: jQuery present in your page source and no “$ is not a function” errors in the browser console.
Get free WordPress & AI tips
Join 500+ readers. No spam, unsubscribe anytime.
This usually points to a theme that loads different templates or scripts for mobile viewports. It can also be caused by a touch event conflict in a theme’s JavaScript. Activate Storefront and test on mobile — if it works there, the issue is in your theme’s mobile-specific code or template overrides.
Yes. Cloudflare’s Rocket Loader feature can delay or break WooCommerce’s AJAX scripts. Certain firewall rules also block requests to admin-ajax.php or URLs containing ?wc-ajax=. Temporarily set your Cloudflare zone to Development Mode and test the button. If it works, disable Rocket Loader and audit your firewall rules for blocks on those two URL patterns.
Not exactly a different bug, but a different trigger. Variable products require the customer to select all required attributes before the Add to Cart button activates. If the button stays grey or unresponsive, check that every attribute used in your variations is assigned, and that at least one variation is marked In Stock with a price set.
No. Switching themes only changes which theme is active — all your saved customizations remain in the database. When you switch back to your original theme, everything is restored. The one exception is the WordPress Customizer, where some settings are stored per-theme and will not carry over between different themes.