Hide max price for variable products in WooCommerce

add_filter( 'woocommerce_variable_sale_price_html', 'hide_variable_max_price', PHP_INT_MAX, 2 );
add_filter( 'woocommerce_variable_price_html',      'hide_variable_max_price', PHP_INT_MAX, 2 );
function hide_variable_max_price( $price, $_product ) {
	$min_price_regular = $_product->get_variation_regular_price( 'min', true );
	$min_price_sale    = $_product->get_variation_sale_price( 'min', true );
	return ( $min_price_sale == $min_price_regular ) ?
		wc_price( $min_price_regular ) :
		'' . wc_price( $min_price_regular ) . '' . '' . wc_price( $min_price_sale ) . '';
}

5 thoughts on “Hide max price for variable products in WooCommerce”

    1. Hi,

      You should put the code in your (child) theme’s functions.php file.

      Best regards,
      Tom

Leave a Comment