“From €19” instead of a price range
Variable products show their lowest price as “From €19” instead of “€19 – €49”.
<?php
add_filter(
'woocommerce_variable_price_html',
static function ( $price, $product ) {
$min = $product->get_variation_price( 'min', true );
$max = $product->get_variation_price( 'max', true );
if ( $min === $max ) {
return $price;
}
/* translators: %s: lowest price */
return sprintf( __( 'From: %s', 'woocommerce' ), wc_price( $min ) . $product->get_price_suffix() );
},
10,
2
);
In these packs
- WooCommerce: shop and product pages: Badges, price display, tabs and layout for your shop and product pages.