Show max variable price in shop page : <p>I want to display the maximum variation price in woocommerce shop page under product title. </p>

<p>I have tried using this code but does not seem to work, only breaks my site instead.</p>

<p>add_filter( ‘woocommerce_variable_sale_price_html’, ‘con_show_max_variation_price_only’, 10, 2 );
add_filter( ‘woocommerce_variable_price_html’, ‘con_show_max_variation_price_only’, 10, 2 );</p>

<p>function con_show_max_variation_price_only( $price, $product ) {</p>

<p>// Main Variation Price
$prices = array( $product->get_variation_price( ‘max’, true ), $product->get_variation_price( ‘min’, true ) );</p>

<p>$price = $prices[0] !== $prices[1] ? sprintf( __( ‘%1$s’, ‘woocommerce’ ), wc_price( $prices[0] ) ) : wc_price( $prices[0] );</p>
