From f2415b37616b7787c78f6478253f520680b7ed4b Mon Sep 17 00:00:00 2001 From: kathy Date: Mon, 6 Aug 2012 19:27:24 -0500 Subject: [PATCH] switch get_price() checks to is_purchasable() for displaying Add to Cart button --- classes/class-wc-product.php | 2 +- templates/loop/add-to-cart.php | 2 +- templates/single-product/add-to-cart/simple.php | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/classes/class-wc-product.php b/classes/class-wc-product.php index 92c473b154a..435cffd10a6 100644 --- a/classes/class-wc-product.php +++ b/classes/class-wc-product.php @@ -605,7 +605,7 @@ class WC_Product { elseif ( $this->get_price() === '' ) $purchasable = false; - return apply_filters( 'woocommerce_is_purchasable', $purchasable ); + return apply_filters( 'woocommerce_is_purchasable', $purchasable, $this ); } /** Returns the price (excluding tax) - ignores tax_class filters since the price may *include* tax and thus needs subtracting */ diff --git a/templates/loop/add-to-cart.php b/templates/loop/add-to-cart.php index 6bec0608522..d81386e21fe 100644 --- a/templates/loop/add-to-cart.php +++ b/templates/loop/add-to-cart.php @@ -5,7 +5,7 @@ global $product; -if ( $product->get_price() === '' && $product->product_type != 'external' ) return; +if ( ! $product->is_purchasable() && $product->product_type != 'external' ) return; ?> is_in_stock() ) : ?> diff --git a/templates/single-product/add-to-cart/simple.php b/templates/single-product/add-to-cart/simple.php index 78060dd3124..0a8998e955f 100644 --- a/templates/single-product/add-to-cart/simple.php +++ b/templates/single-product/add-to-cart/simple.php @@ -5,7 +5,7 @@ global $woocommerce, $product; -if ( $product->get_price() === '' ) return; +if ( ! $product->is_purchasable() ) return; ?>