How to Show “From” Price for WooCommerce Variables
Using a “From” pricing format, like “From $15,” is a great marketing strategy because it simplifies the way prices are presented to potential customers. It instantly highlights the lowest price for a product, making it more attractive and accessible, especially for variable products with multiple options.
Psychologically, consumers are more likely to focus on the lower price, which can encourage them to explore further without feeling overwhelmed by a range of prices. This approach reduces decision fatigue and sets expectations clearly, ultimately improving conversion rates.
// CUSTOM PRICE FORMAT FOR WOOCOMMERCE
// Shows "From" followed by the lowest price for variable products, instead of the price range.
add_filter( 'woocommerce_get_price_html', 'custom_price_format_min_only', 100, 2 );
function custom_price_format_min_only( $price, $product ) {
// Ensure a valid product object
if ( ! $product instanceof WC_Product ) {
return esc_html( 'Price not available' );
}
// Cache key for variable product prices
$cache_key = 'custom_price_' . $product->get_id();
$cached_price = wp_cache_get( $cache_key, 'woocommerce' );
if ( false !== $cached_price ) {
return $cached_price;
}
if ( $product->is_type( 'variable' ) ) {
$prices = $product->get_variation_prices( true );
if ( ! empty( $prices['price'] ) ) {
$min_price = reset( $prices['price'] );
if ( is_numeric( $min_price ) ) {
$formatted_price = wc_price( $min_price );
$price = sprintf( 'From %s', $formatted_price );
} else {
$price = esc_html( 'Price not available' );
}
} else {
// Fallback to default product price for variable products with no valid variations
$default_price = $product->get_price();
$price = is_numeric( $default_price ) ? wc_price( $default_price ) : esc_html( 'Price not available' );
}
} else {
// Fallback for non-variable products
$default_price = $product->get_price();
$price = is_numeric( $default_price ) ? wc_price( $default_price ) : esc_html( 'Price not available' );
}
// Cache the result for 30 minutes
wp_cache_set( $cache_key, $price, 'woocommerce', 30 * MINUTE_IN_SECONDS );
return $price;
}
// Invalidate cache when product is updated
add_action( 'woocommerce_update_product', 'invalidate_custom_price_cache' );
function invalidate_custom_price_cache( $product_id ) {
$cache_key = 'custom_price_' . $product_id;
wp_cache_delete( $cache_key, 'woocommerce' );
}How the Snippet Works
This snippet modifies the default WooCommerce price display for variable products, showing the lowest price with a “From” label, instead of displaying a full range. It uses caching to enhance performance, storing the price for 30 minutes and reducing server load. The snippet works by hooking into WooCommerce’s price display system, ensuring that the lowest price is always shown without constant recalculations.
Why It’s Better Than Standard Short Snippets
Unlike many common shortcodes you might find, this solution is designed to be more efficient and user-friendly. It leverages caching to reduce database queries and improve page load times. It also handles edge cases, like missing or invalid price data, with clean fallbacks, ensuring a smoother user experience. Plus, the “From” pricing approach is a proven technique that helps simplify the purchase decision and increases customer satisfaction.
Written by Milan on 10th July 2025

