Display WooCommerce Discount to Customer for Product on Sale

In this post I am going to show you how to display WooCommerce discount to customer for product on sale. Sometime when a product is on sale, you want to show total discount to customer on Cart & Checkout pages.

Product Price or Regular Price or Retail Price all are the actual price of the product. The Sale price is a temporary price when a specific product is on sale. The below image “You Saved” section displays the total discount amount.

WooCommerce Discount

WooCommerce get_cart() function holds all the data of products added to cart. Call get_cart() function and loop through it to get individual product details.

The get_sale_price() function fetches product sale price and get_regular_price() fetches product actual price.

Add the below code to child theme functions.php file, it displays discount on cart and checkout pages for product on sale.

Your one social media share will help others

Leave a Comment