Popular Categories
How to disable WooCommerce Variable product price range?
Are you looking to disable the variable product price range which normally looks like $100-$200. With the snippet of code give below you will be able to hide the price range, and replace it with “From: ” in front of the minimum price. All you need is pasting the following code in your child theme’s functions.php
add_filter( 'woocommerce_variable_price_html', 'variation_price_format_min', 9999, 2 ); function variation_price_format_min( $price, $product ) { $prices = $product->get_variation_prices( true ); $min_price = current( $prices['price'] ); $price = sprintf( __( 'From: %1$s', 'woocommerce' ), wc_price( $min_price ) ); return $price; }
Where to add this snippet?
You can place PHP snippets at the bottom of your theme in functions.php file.