WooCommerce Tutorial: How to show You Save Amount from Product Sale Price

In this WooCommerce Tutorial tips i will share on how to show the You Save Amount from Product Sale Price to the single product page, this function is not available in WooCommerce by default, so to show this we need to add a piece of php code in functions.php to show it.

To work this properly, off course you need to set the Regular Price and Sale Price on the product, once you add the sale price it worked properly well.

Adding this future on your eCommerce site is the part of price psychology or one of the sales trigger technique to your customers, There have a few of sales trigger technique and will share here in the future.

and let get’s started.


Put this code in your functions.php on your active theme.

function you_save_echo_product() {
	global $product;

	// works for Simple and Variable type
	$regular_price 	= get_post_meta( $product->get_id(), '_regular_price', true ); // 36.32
	$sale_price 	= get_post_meta( $product->get_id(), '_sale_price', true ); // 24.99
	if( !empty($sale_price) ) {
		$saved_amount 		= $regular_price - $sale_price;
		$currency_symbol 	= get_woocommerce_currency_symbol();

		$percentage = round( ( ( $regular_price - $sale_price ) / $regular_price ) * 100 );
			<p class="you_save_price">You Save: <?php echo $currency_symbol .''. number_format($saved_amount, 2, '.', ''); ?></p>				
add_action( 'woocommerce_single_product_summary', 'you_save_echo_product', 11 ); // hook number

This code works well in Simple and Variable Product type, if you using a Currency Switcher plugin it works well too… of course you can edit the css style on this tag.

Like this post? kindly like and share to your friend, thank you for reading clearly.