1

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).

1 Answer 1

1

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 agree to our terms of service and acknowledge you have read our privacy policy.

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