Merge pull request #411 from typeplus/master - Thx @typeplus
Variable product ajax_add_to_cart fix.
This commit is contained in:
commit
37dc527e5b
|
@ -19,15 +19,16 @@
|
||||||
if ( ! defined( 'ABSPATH' ) ) {
|
if ( ! defined( 'ABSPATH' ) ) {
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
global $product;
|
global $product;
|
||||||
|
|
||||||
echo apply_filters( 'woocommerce_loop_add_to_cart_link',
|
echo apply_filters( 'woocommerce_loop_add_to_cart_link',
|
||||||
sprintf( '<a rel="nofollow" href="%s" data-quantity="%s" data-product_id="%s" data-product_sku="%s" class="add_to_cart_button ajax_add_to_cart btn btn-outline-primary btn-block">%s</a>',
|
sprintf( '<div class="add-to-cart-container"><a href="%s" rel="nofollow" data-product_id="%s" data-product_sku="%s" data-quantity="%s" class="%s product_type_%s single_add_to_cart_button btn btn-outline-primary btn-block %s"> %s</a></div>',
|
||||||
esc_url( $product->add_to_cart_url() ),
|
esc_url( $product->add_to_cart_url() ),
|
||||||
esc_attr( isset( $quantity ) ? $quantity : 1 ),
|
|
||||||
esc_attr( $product->get_id() ),
|
esc_attr( $product->get_id() ),
|
||||||
esc_attr( $product->get_sku() ),
|
esc_attr( $product->get_sku() ),
|
||||||
|
esc_attr( isset( $quantity ) ? $quantity : 1 ),
|
||||||
|
$product->is_purchasable() && $product->is_in_stock() ? 'add_to_cart_button' : '',
|
||||||
|
esc_attr( $product->get_type() ),
|
||||||
|
$product->get_type() == 'simple' ? 'ajax_add_to_cart' : '',
|
||||||
esc_html( $product->add_to_cart_text() )
|
esc_html( $product->add_to_cart_text() )
|
||||||
),
|
),
|
||||||
$product );
|
$product );
|
||||||
|
|
Reference in New Issue