Chat with us, powered by LiveChat

This website uses cookies

Our website, platform and/or any sub domains use cookies to understand how you use our services, and to improve both your experience and our marketing relevance.

How to Change Variable Product Price Range in WooCommerce

October 3, 2017

2 Min Read
Reading Time: 2 minutes

Before WooCommerce 2.1, the range of the prices for products were not displayed. Thus instead of showing “From  55-60”, the price showed up as “Starting from  55”.

Variable Product Price Range

In many cases, the store owners do not wish to display the full range of price. However, this is no longer the option in the newer versions of WooCommerce.

test product


To implement this, you need to add the following code snippet to the functions.php of your theme. This file is located in the theme folder.

function cw_prc_varb( $val_price, $product ) {

    $prefix = sprintf('%s: ', __('From', 'through'));
    $cw_reg_min_prc = $product->get_variation_regular_price( 'min', true );
    $cw_min_sale_prc    = $product->get_variation_sale_price( 'min', true );
    $cw_prc_max = $product->get_variation_price( 'max', true );
    $cw_prc_min = $product->get_variation_price( 'min', true );

    $val_price = ( $cw_min_sale_prc == $cw_reg_min_prc ) ?
        wc_price( $cw_reg_min_prc ) :
        '<del>' . wc_price( $cw_reg_min_prc ) . '</del>' . '<ins>' . wc_price( $cw_min_sale_prc ) . '</ins>';

    return ( $cw_prc_min == $cw_prc_max ) ?
        $val_price :
        sprintf('%s%s', $prefix, $val_price);


add_filter( 'woocommerce_variable_sale_price_html', 'cw_prc_varb' );
add_filter( 'woocommerce_variable_price_html', 'cw_prc_varb' );


test product output


In this tutorial I have discussed how you could easily change the present behavior of  the display of the price range on WooCommerce stores. If you need any help with the implementation of this idea, do leave a comment below.

Share your opinion in the comment section. COMMENT NOW

Share This Article

Your WooCommerce Store Needs A Reliable Host

With no compromise on Performance, Security & Support.

Owais Alam

is the WordPress Community Manager at Cloudways - A Managed WooCommerce Hosting Platform and a seasoned PHP developer. He loves to develop all sorts of websites on WordPress and is in love with WooCommerce in particular. You can email him at

Get Our Newsletter
Be the first to get the latest updates and tutorials.

Do you like what you read?

Get the Latest Updates

Share Your Feedback

Please insert Content

Thank you for your feedback!

BFCM 2019