Untitled

mail@pastecode.io avatar
unknown
plain_text
a year ago
528 B
0
Indexable
Never
add_filter('b2bking_filter_wholesale_price_final', function($price, $retail_text, $retail_price, $wholesale_text, $wholesale_price, $product_id){
	// calculate percentage
	$percent = b2bking()->reverse_wc_price($wholesale_price) / b2bking()->reverse_wc_price($retail_price) * 100;
	$value = b2bking()->reverse_wc_price($retail_price) - b2bking()->reverse_wc_price($wholesale_price);
	$price .= '<br><span style="font-weight:500;font-size:18px">You save '.wc_price($value).' ('.$percent.'%)'.'</span>';
	return $price;
}, 10, 6);