Only add add_to_cart_button if purchasable and in stock

This commit is contained in:
Mike Jolley 2014-06-03 14:38:00 +01:00
parent f76953c3ba
commit 071815aebb
1 changed files with 1 additions and 1 deletions

View File

@ -16,7 +16,7 @@ echo apply_filters( 'woocommerce_loop_add_to_cart_link',
esc_url( $product->add_to_cart_url() ),
esc_attr( $product->id ),
esc_attr( $product->get_sku() ),
$product->is_purchasable() ? 'add_to_cart_button' : '',
$product->is_purchasable() && $product->is_in_stock() ? 'add_to_cart_button' : '',
esc_attr( $product->product_type ),
esc_html( $product->add_to_cart_text() )
),