Hi. i found out this code but it apply taxes on taxes:
/* Display strike out price for WooCommerce Variable products
add_filter(‘woocommerce_get_price_html’, ‘elex_display_striked_out_price_for_variable’, 200, 2);
function elex_display_striked_out_price_for_variable($price=”, $product)
{
if(!$product->is_on_sale()){
return $price;
}
$reg_price = ”;
if($product->is_type( ‘variable’ ))
{
$variations = $product->get_children();
$reg_prices = array();
$sale_prices = array();
foreach ($variations as $value) {
$single_variation=new WC_Product_Variation($value);
array_push($reg_prices, $single_variation->get_regular_price());
array_push($sale_prices, $single_variation->get_price());
}
sort($reg_prices);
sort($sale_prices);
$min_price = $reg_prices[0];
$max_price = $reg_prices[count($reg_prices)-1];
if($min_price == $max_price)
{
$reg_price = wc_price($min_price);
}
else
{
$reg_price = wc_format_price_range($min_price, $max_price);
}
$min_price = $sale_prices[0];
$max_price = $sale_prices[count($sale_prices)-1];
if($min_price == $max_price)
{
$sale_price = wc_price($min_price);
}
else
{
$sale_price = wc_format_price_range($min_price, $max_price);
}
return wc_format_sale_price($reg_price, $sale_price);
}
return $price;
}
Variation discount price on archive page
Marco Galizzi
Dear All,
is it possible to show the discount price beside the crossed out origanl price, like happens with the simple products discount?
Here’s the page were we show discounts:
https://www.bali1987.it/categoria-prodotto/black-friday/
Thank you for your support.
Best regards.