Variations - From £0.00

//Variations - From £0.00
add_filter('woocommerce_get_price_html', 'change_variable_products_price_display', 10, 2);
function change_variable_products_price_display($price, $product)
{

    if (!$product->is_type('variable')) return $price;

    $prices = $product->get_variation_prices(true);

    if (empty($prices['price'])) return apply_filters('woocommerce_variable_empty_price_html', '', $product);

    $min_price = current($prices['price']);
    $max_price = end($prices['price']);
    $prefix_html = '<span class="price-prefix">' . __('From: ') . '</span>';

    $prefix = $min_price !== $max_price ? $prefix_html : ''; // HERE the prefix
    return apply_filters('woocommerce_variable_price_html', $prefix . wc_price($min_price) . $product->get_price_suffix() , $product);
}
[instagram-feed feed=1]
© 2023 BenaDigital Limited | All Rights Reserved
magnifiercrosschevron-down