You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
As reported on the support forum, users browsing a site with WooCommerce and the Speculative Loading plugin can end up getting products added to their shopping cart by just hovering over the Add to Cart button when in moderate eagerness (the default setting). What's worse is when the eager eagerness setting is enabled, all the products on the page can be added to the cart just by visiting the page.
Steps to reproduce
Activate and configure WooCommerce (and install the Storefront theme, perhaps)
Activate the Speculative Loading plugin
Access the shop page and hover over an Add to Cart button
In both cases, however, rel=nofollow is present (although it can be filtered out by the woocommerce_loop_add_to_cart_args filter). It's unfortunate that since these add-to-cart links aren't idempotent (i.e. they have an action) that they don't also have _wpnonce query parameters.
Bug Description
As reported on the support forum, users browsing a site with WooCommerce and the Speculative Loading plugin can end up getting products added to their shopping cart by just hovering over the Add to Cart button when in moderate eagerness (the default setting). What's worse is when the eager eagerness setting is enabled, all the products on the page can be added to the cart just by visiting the page.
Steps to reproduce
Screenshots
Screen.recording.2024-04-15.11.49.08.webm
Additional Context
When not using a block theme, this is the code to create the add-to-cart button:
https://github.com/woocommerce/woocommerce/blob/a8e84d8c8b20558f66ed33dcbee6c1dec300752f/plugins/woocommerce/includes/wc-template-functions.php#L1363-L1403
https://github.com/woocommerce/woocommerce/blob/a8e84d8c8b20558f66ed33dcbee6c1dec300752f/plugins/woocommerce/templates/loop/add-to-cart.php#L27-L32
Note an
atag is always used. Contrast with the block code:https://github.com/woocommerce/woocommerce/blob/a8e84d8c8b20558f66ed33dcbee6c1dec300752f/plugins/woocommerce/src/Blocks/BlockTypes/ProductButton.php#L74-L231
Here a
buttonis used when AJAX is enabled.In both cases, however,
rel=nofollowis present (although it can be filtered out by thewoocommerce_loop_add_to_cart_argsfilter). It's unfortunate that since these add-to-cart links aren't idempotent (i.e. they have an action) that they don't also have_wpnoncequery parameters.