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;
}

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.