Merge pull request #7123 from splashingpixels/variation-price-issue

correctly display FREE if all prices are zero ref #6929
This commit is contained in:
Mike Jolley 2015-01-16 16:14:02 +00:00
commit 36841589cf
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 ) {
$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 );