WooCommerce now ensures that on variable product pages, the Add to Cart button is disabled until the variation script has fully loaded. Previously, on slower connections, users could click “Add to Cart” before the variation selection logic initialized, leading to failed submissions.
This change:
- Adds a
disabledattribute to the add-to-cart button for variable products. - Ensures JavaScript enables that button once the script is loaded.
How can developers tell if they are affected?
Stores that comply with these three conditions are affected:
- Have variable products.
- The default
/client/legacy/js/frontend/add-to-cart-variation.jsscript is dequeued from the product page. - The default
/templates/single-product/add-to-cart/variation-add-to-cart-button.phptemplate is not overridden.
Stores using the new Add to Cart + Options block aren’t affected by this change.
What action do developers need to take if affected?
Stores that dequeue the default add-to-cart-variation.js script but use the default variation-add-to-cart-button.php template will need to update their custom script to remove the disabled attribute from the variation Add to Cart button, like it’s now done in the default script.
Leave a Reply