From b04ca159527de284598501cf645b3cf945ee493b Mon Sep 17 00:00:00 2001 From: Mike Jolley Date: Tue, 3 Jun 2014 14:35:42 +0100 Subject: [PATCH] Only add add_to_cart_button if purchasable and in stock Fixes #5132 --- templates/loop/add-to-cart.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/templates/loop/add-to-cart.php b/templates/loop/add-to-cart.php index 3fd4a59c31c..67ce1f6748d 100644 --- a/templates/loop/add-to-cart.php +++ b/templates/loop/add-to-cart.php @@ -15,9 +15,9 @@ echo apply_filters( 'woocommerce_loop_add_to_cart_link', sprintf( '%s', 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() ) ),