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”
Leave a Comment
You must be logged in to post a comment.
WHERE do we paste this into the code? Be specific
Hi,
You should put the code in your (child) theme’s functions.php file.
Best regards,
Tom
@Tom: is it possible to show minimum price only?? and how??
Thank you very much
Oh I’m sorry, Show maximum price only, not minimum price
thanks
How do I create a space between the sale price and regular price? I have no space.