WooCommerce Show Save How Many Percentage

With WooCommerce Snippet

When using WooCommerce, some users would like to set the item with a sale price. Default WooCommerce just strikethrough the regular price and show only sale price. Customers don’t know how many actually they save. With this WooCommerce snippet, it will show how many percentage they sale from a regular price.

Paste below coding at your theme’s function.php

<?php
add_filter( 'woocommerce_sale_price_html', 'woocommerce_sales_price_percentage', 10, 2 );
function woocommerce_sales_price_percentage( $price, $product ) {
	$percentage = round( ( ( $product->regular_price - $product->sale_price ) / $product->regular_price ) * 100 );
	return $price . sprintf( __(' - Save %s', 'woocommerce' ), $percentage . '%' );
}
?>

Result:
WooCommerce Show Save How Many Percentage

Show Percentage Is More Attractive

Now, the percentage of discount is displayed next to sale price. Customers able to know how many actually they save from a regular price. With percentage of discount, it’s more attractive!

External Link: WooCommerce Percentage Saved Sale Price

WooCommerce Show Save How Many Percentage
Please do hesitate to contact me if you found out any mistake or typo.

Leave a Comment.

Time limit is exhausted. Please reload CAPTCHA.