correctly display FREE if all prices are zero ref #6929

This commit is contained in:
splashingpixels 2015-01-15 20:19:33 -08:00
parent a82aa2bd13
commit 187f6729e9
1 changed files with 6 additions and 5 deletions

View File

@ -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 ) {
} else {
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 );