Untitled
unknown
plain_text
9 months ago
807 B
6
Indexable
add_filter('b2bking_dynamic_recalculate_sale_price_display', function($price_html, $product, $sale_price){
if ($product){
if ($product->is_on_sale()){
if ($product->is_type('variable')){
$children = $product->get_children();
$variation = wc_get_product($children[0]);
$regprice = $variation->get_regular_price();
$saleprice = $variation->get_sale_price();
if ($regprice !== $saleprice){
if ($saleprice < $regprice){
$price_html = wc_format_sale_price( $regprice, $saleprice) . $product->get_price_suffix($saleprice);
} else {
$price_html = wc_price($saleprice) . $product->get_price_suffix($saleprice);
}
} else {
$price_html = wc_price($regprice) . $product->get_price_suffix($regprice);
}
}
}
}
return $price_html;
}, 100000, 3);Editor is loading...
Leave a Comment