Hot to add WooCommerce Display Fixed Saving Amount On Sale Products

Table of Contents

Post Intro

Display Fixed Savings on WooCommerce Sale Products

As an e-commerce store owner, you’re always looking for ways to boost sales. One effective method is clearly showing customers the value they’re getting. Instead of just displaying a strikethrough price, why not show them the exact amount they’re saving? This simple change can make your sale products more appealing and encourage customers to make a purchase. This blog post will show you how to add a line of text that displays the fixed savings amount on your WooCommerce products using a simple code snippet.

Youtube Tutorial

Sign in to unlock all code snippets and resources

100% tested and verified code snippets

New here? Register for free to get started

© Copyright – 2025 – All Rights Reserved.  Created by SuperWP

Post More Detail

The Code Snippet

The code snippet provided targets both simple and variable products, ensuring a consistent experience across your store. Let’s break down what each part does:

Plugin Used:

Code snippet Plugin

Simple Products

The first function, woo_display_fixed_amount_savings_on_sale_simple_products, uses the woocommerce_get_price_html filter. This filter modifies the price displayed for a product.

  • if ( $product->is_on_sale() && $product->is_type( 'simple' ) ): This line checks if the product is a simple product and if it’s currently on sale.
  • $regular_price = $product->get_regular_price();: This retrieves the product’s original price.
  • $sale_price = $product->get_sale_price();: This retrieves the product’s current sale price.
  • $savings = $regular_price - $sale_price;: This calculates the exact amount the customer is saving.
  • $price .= '<br><small>You save ' . wc_price($savings) . '!</small>';: This line adds the “You save [amount]” text to the existing price HTML. The wc_price() function formats the savings amount according to your store’s currency settings.

Variable Products

The second function, woo_display_fixed_amount_savings_on_sale_variable_products, uses the woocommerce_available_variation filter. This is specifically for products with variations (e.g., different sizes or colors). This code will display the savings once a variation has been selected by the customer.

  • if( $variation->is_on_sale() ): This checks if the selected variation is on sale.
  • $savings_amount = $data['display_regular_price'] - $data['display_price'];: This calculates the savings amount for the specific variation.
  • $data['price_html'] .= 'You save' . wc_price($savings_amount);: This appends the savings text to the price display for the variation.

How to Implement the Snippet

There are two primary ways to add this code to your WooCommerce store:

  1. Child Theme’s functions.php file: This is the most common method. Access your theme files via FTP or cPanel’s File Manager and add the code to the end of your functions.php file. Important: Always use a child theme to avoid losing your changes during a theme update.
  2. Code Snippets Plugin: For an easier and safer method, use a plugin like “Code Snippets.” This allows you to add, manage, and activate code snippets directly from your WordPress dashboard without modifying core theme files.

Conclusion In summary

Conclusion

By displaying the exact amount customers are saving, you’re not just showing a discount; you’re highlighting the tangible value of the purchase. This small tweak can significantly improve conversion rates on your sale products. Implement this simple code snippet today and give your customers another reason to click “Add to Cart!”

Stay UpTo Date with Latest Post And news: