Display lowest product variation price first in WooCommerce on child sites.
Snippet Type
Execute on Child Sites
Snippet
function reformat_pricing_labels( $price, $product ) {
$label = __( 'Starting', 'textdomain' );
$min_price_regular = $product->get_variation_regular_price( 'min', true );
$min_price_sale = $product->get_variation_sale_price( 'min', true );
$max_price = $product->get_variation_price( 'max', true );
$min_price = $product->get_variation_price( 'min', true );
if ( $min_price_sale === $min_price_regular ) {
$price = wc_price( $min_price_regular );
}
return $min_price === $max_price ? $price : sprintf( '%s %s', $label, $price );
}
add_filter( 'woocommerce_variable_sale_price_html', 'reformat_pricing_labels', 10, 2 );
add_filter( 'woocommerce_variable_price_html', 'reformat_pricing_labels', 10, 2 );