Merge pull request #7123 from splashingpixels/variation-price-issue
correctly display FREE if all prices are zero ref #6929
This commit is contained in:
commit
36841589cf
|
@ -316,13 +316,14 @@ class WC_Product_Variable extends WC_Product {
|
||||||
|
|
||||||
if ( $price !== $saleprice ) {
|
if ( $price !== $saleprice ) {
|
||||||
$price = apply_filters( 'woocommerce_variable_sale_price_html', $this->get_price_html_from_to( $saleprice, $price ) . $this->get_price_suffix(), $this );
|
$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 = __( 'Free!', 'woocommerce' );
|
||||||
$price = apply_filters( 'woocommerce_variable_free_price_html', $price, $this );
|
$price = apply_filters( 'woocommerce_variable_free_price_html', $price, $this );
|
||||||
} else {
|
} else {
|
||||||
$price = apply_filters( 'woocommerce_variable_price_html', $price . $this->get_price_suffix(), $this );
|
$price = apply_filters( 'woocommerce_variable_price_html', $price . $this->get_price_suffix(), $this );
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return apply_filters( 'woocommerce_get_price_html', $price, $this );
|
return apply_filters( 'woocommerce_get_price_html', $price, $this );
|
||||||
|
|
Loading…
Reference in New Issue