Skip to content

Early-bird lifetime licence: $199 once, for the first 200 buyers only. See the offer

“From €19” instead of a price range

Variable products show their lowest price as “From €19” instead of “€19 – €49”.

  • Type PHP
  • Runs Everywhere (runs as WordPress loads)
  • Needs WooCommerce
  • Category WooCommerce
  • Tested with WordPress 7.1, WooCommerce 11.1
PHP
<?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

Move your snippets over this afternoon.

Importing changes nothing until you switch over, and your old shortcodes keep working.