Home › Forums › WoodMart support forum › Disable variable price (most expensive price) on woocommerce product › Reply To: Disable variable price (most expensive price) on woocommerce product
August 27, 2019 at 1:08 pm
#140659

Jeriss Cloud Center
Participant
@arenar you better try this instead …
/**
* SHOW THE LABEL "FROM X$" FOR ALL VARIABLE PRODUCTS
*/
add_filter( 'woocommerce_variable_sale_price_html', 'wpm_variation_price_format', 10, 2 );
add_filter( 'woocommerce_variable_price_html', 'wpm_variation_price_format', 10, 2 );
function wpm_variation_price_format( $price, $product ) {
$min_price = $product->get_variation_price( 'min', true );
$max_price = $product->get_variation_price( 'max', true );
if ($min_price != $max_price){
$price = sprintf( __( 'From %1$s', 'woocommerce' ), wc_price( $min_price ) );
return $price;
} else {
$price = sprintf( __( '%1$s', 'woocommerce' ), wc_price( $min_price ) );
return $price;
}
}