Only add add_to_cart_button if purchasable and in stock

Fixes #5132
This commit is contained in:
Mike Jolley 2014-06-03 14:35:42 +01:00
parent 01810c3fce
commit b04ca15952
1 changed files with 3 additions and 3 deletions

View File

@ -15,9 +15,9 @@ echo apply_filters( 'woocommerce_loop_add_to_cart_link',
sprintf( '<a href="%s" rel="nofollow" data-product_id="%s" data-product_sku="%s" data-quantity="%s" class="button %s product_type_%s">%s</a>',
esc_url( $product->add_to_cart_url() ),
esc_attr( $product->id ),
esc_attr( $product->get_sku() ),
esc_attr( isset( $quantity ) ? $quantity : 1 ),
$product->is_purchasable() ? 'add_to_cart_button' : '',
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->product_type ),
esc_html( $product->add_to_cart_text() )
),