Skip to content

Instantly share code, notes, and snippets.

@angryoaf
angryoaf / gist:5380297
Last active July 3, 2020 15:26
WooCommerce - Show min - max prices for variations, rather than the min price only. | Also works if products have sale price applied.
/**
* This code should be added to functions.php of your theme
**/
add_filter('woocommerce_variable_price_html', 'custom_variation_price', 10, 2);
function custom_variation_price( $price, $product ) {
$price = '';
if ( !$product->min_variation_price || $product->min_variation_price !== $product->max_variation_price ) $price .= '<div class="lbwWooVariaPrice"> <span class="from">' . _x('From', 'min_price', 'woocommerce') . ' </span>';