diff --git a/templates/loop/add-to-cart.php b/templates/loop/add-to-cart.php index 0af998ee849..33211ba4d56 100644 --- a/templates/loop/add-to-cart.php +++ b/templates/loop/add-to-cart.php @@ -12,11 +12,12 @@ if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly global $product; echo apply_filters( 'woocommerce_loop_add_to_cart_link', - sprintf( '%s', + sprintf( '%s', esc_url( $product->add_to_cart_url() ), esc_attr( $product->id ), esc_attr( $product->get_sku() ), + $product->is_purchasable() ? 'add_to_cart_button' : '', esc_attr( $product->product_type ), esc_html( $product->add_to_cart_text() ) ), -$product ); \ No newline at end of file +$product );