I need to show a discounted sum as a percentage of regular price using in WooCommerce. Original and stroked price + discounted price (of 10%).
Eg.: 100 90
I've tried a lot of plugins and they discount effectively, but I need to SHOW to customers (in product and category pages) the original sum (regular price) and the discounted price (the real prices are already managed by a rental plugin).
I need to show a discounted sum as a percentage of regular price using in WooCommerce. Original and stroked price + discounted price (of 10%).
Eg.: 100 90
I've tried a lot of plugins and they discount effectively, but I need to SHOW to customers (in product and category pages) the original sum (regular price) and the discounted price (the real prices are already managed by a rental plugin).
Ok, maibe I got it:
add_filter('woocommerce_get_price_html', 'custom_price', 10, 2);
function custom_price( $price, $product ) {
$price = 'from ';
$price .= '<del>' . woocommerce_price($product->regular_price *= 1) . '</del> ';
$price .= woocommerce_price($product->regular_price *= 0.9);
$price .= ' per day';
return $price;
}