How to Display Lowest Value for Variable Product in WooCommerce

by | Oct 14, 2016

When we create an ecommerce store based on WordPress and WooCommerce, we have option to add product variation like size, color and price etc. Using these variations, we can create different pricing for different parameters we have set.

This let to a small change in how the product price is displayed on front end. For example if we set a price variation based on size where price is $10 for medium and $15 for large, the price displayed on front page is not $10 or $15 but $10-$15 by default.

If you would like to stop displaying the range and only lowest amount for the product, it can be done by adding the following code to functions.php file of your theme or child theme. It will stop displaying price as $10-$15 but will show $10.

// Use WC 2.0 variable price format to display the lowest value on product single page and not the whole range along with sale price.

add_filter( ‘woocommerce_variable_sale_price_html’, ‘wc_wc20_variation_price_format’, 10, 2 );
add_filter( ‘woocommerce_variable_price_html’, ‘wc_wc20_variation_price_format’, 10, 2 );
function wc_wc20_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;

About Karan Kumar
Karan loves making web beautiful with his keen eyes toward design.