From 187f6729e9bf602bb6ec66ecb9b7d0170f86b4ad Mon Sep 17 00:00:00 2001 From: splashingpixels Date: Thu, 15 Jan 2015 20:19:33 -0800 Subject: [PATCH] correctly display FREE if all prices are zero ref #6929 --- includes/class-wc-product-variable.php | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/includes/class-wc-product-variable.php b/includes/class-wc-product-variable.php index c9df7fdd345..daf5257fe53 100644 --- a/includes/class-wc-product-variable.php +++ b/includes/class-wc-product-variable.php @@ -316,13 +316,14 @@ class WC_Product_Variable extends WC_Product { if ( $price !== $saleprice ) { $price = apply_filters( 'woocommerce_variable_sale_price_html', $this->get_price_html_from_to( $saleprice, $price ) . $this->get_price_suffix(), $this ); - } elseif ( $price == 0 ) { - $price = __( 'Free!', 'woocommerce' ); - $price = apply_filters( 'woocommerce_variable_free_price_html', $price, $this ); } else { - $price = apply_filters( 'woocommerce_variable_price_html', $price . $this->get_price_suffix(), $this ); + if ( $prices[0] === 0 && $prices[1] === 0 ) { + $price = __( 'Free!', 'woocommerce' ); + $price = apply_filters( 'woocommerce_variable_free_price_html', $price, $this ); + } else { + $price = apply_filters( 'woocommerce_variable_price_html', $price . $this->get_price_suffix(), $this ); + } } - } return apply_filters( 'woocommerce_get_price_html', $price, $this );