Hello,
You can show the sale label as a percentage from > Theme Settings > Shop > Product Labels > Sale label — just select the “sale label in percentage” option.
However, if you want to display the discount percentage next to the price, There is no option available for this in the theme settings. This requires customization, which is beyond our support policy.
I have searched for a possible solution and found a custom function that you can add to your functions.php file. I have tested this code on our test site, and it is working fine.
If the provided code does not work as expected, unfortunately, we are unable to modify it further.
Add this to your theme’s functions.php file of the theme.
add_filter('woocommerce_get_price_html', 'pk_show_discount_after_price', 99, 2);
function pk_show_discount_after_price($price, $product) {
if ($product->is_on_sale() && !is_admin()) {
$regular_price = $product->get_regular_price();
$sale_price = $product->get_sale_price();
if ($regular_price > 0 && $sale_price < $regular_price) {
$percentage = round((($regular_price - $sale_price) / $regular_price) * 100);
$price .= ' <span class="discount-percentage">(' . $percentage . '% off)</span>';
}
}
return $price;
}
Hope this Helps!
Best Regards,