Variable products would get added to cart via the button, even
when the button said “Select options” and contained a link.

This was because the button was automatically hydrated
through a CSS class.
This commit is contained in:
Lucio Giannotta 2023-01-16 18:54:25 +01:00 committed by GitHub
parent f438ea8ba2
commit 26ae17ffa0
1 changed files with 1 additions and 1 deletions

View File

@ -101,7 +101,7 @@ class ProductButton extends AbstractBlock {
esc_url( $product->add_to_cart_url() ),
esc_attr( $product->get_id() ),
esc_attr( $product->get_sku() ),
$product->is_purchasable() ? 'ajax_add_to_cart add_to_cart_button' : '',
$product->is_purchasable() && ! $product->has_options() ? 'ajax_add_to_cart add_to_cart_button' : '',
esc_attr( $product->get_type() ),
esc_attr( $styles_and_classes['classes'] ),
esc_attr( $styles_and_classes['styles'] ),