How to Show “You Save” text in WooCommerce

you save text in WooCommerce

Customers are always on the look for discounts when buying their desired products. Showing customers how much they can save when buying from your store is a way to motivate them for buying through your store and it’s a proven method as well. What good is a discount when it doesn’t even attract new customers. To make the discount more visible E-store admins look for ways to highlight the discounted amount. One of such ways is to mention how much the customer is saving on the next order. 

How to show “You Save” text in WooCommerce

There are 2 methods to show “You Save” text in WooCommerce. These methods are

  • Programmatically
    • You Save (X%)
    • You Save (X$)
    • You Save X$(X%)
  • Using a Plugin

Method #1 – Programatically

When showing “You Save” text in WooCommerce firstly you should decide whether you want to show discount percentage, discount amount or both. Below are the codes that you will paste in your functions.php file of your child theme.

For showing discount percentage “You Save X%”

add_action('woocommerce_get_price_html', 'add_you_save_text_woocommerce', 100, 2);

function add_you_save_text_woocommerce( $price_html, $product ){

ob_start();

    if( !$product->is_type('variable') ) {

        $regular_price  = $product->get_regular_price();

        $active_price   = $product->get_price();

         if( !empty($active_price) && $active_price < $regular_price ) {

$percentage   = intval( ( ( $regular_price - $active_price ) / $regular_price ) * 100 );

?>

<br>

<p class="you_save_text_woocommerce">

<b>You Save: <?php echo" (". $percentage."%)"; ?></b>

</p>

<?php        

        }

}

return $price_html . ob_get_clean();

}

Note – You can change the styling of text with some minor css tweaking

For showing discount amount and percentage “You Save X$”

add_action('woocommerce_get_price_html', 'add_you_save_text_woocommerce', 100, 2);

function add_you_save_text_woocommerce( $price_html, $product ){

ob_start();

    if( !$product->is_type('variable') ) {

        $regular_price  = $product->get_regular_price();

        $active_price   = $product->get_price();

         if( !empty($active_price) && $active_price < $regular_price ) {

$amount_saved = $regular_price - $active_price;

?>

<br>

<p class="you_save_text_woocommerce">

<b>You Save: <?php echo wp_kses_post( wc_price( $amount_saved ) )  ; ?></b>

</p>

<?php        

        }

}

return $price_html . ob_get_clean();

}

For showing discount amount and percentage “You Save X$(X%)”

add_action('woocommerce_get_price_html', 'add_you_save_text_woocommerce', 100, 2);

function add_you_save_text_woocommerce( $price_html, $product ){

ob_start();

    if( !$product->is_type('variable') ) {

        $regular_price  = $product->get_regular_price();

        $active_price   = $product->get_price();

         if( !empty($active_price) && $active_price < $regular_price ) {

$amount_saved = $regular_price - $active_price;

$percentage   = intval( ( ( $regular_price - $active_price ) / $regular_price ) * 100 );

?>

<br>

<p class="you_save_text_woocommerce">

<b>You Save: <?php echo wp_kses_post( wc_price( $amount_saved ) ) . " (". $percentage."%)"; ?></b>

</p>

<?php        

        }

}

return $price_html . ob_get_clean();

}

Method #2 – Using A Plugin

For showing “You Save x%” text in WooCommerce, you can also use plugins. Following of the 2 plugins will help you show custom text under add to cart button:

  • Custom Stock Status for WooCommerce
  • Pre Orders and Backorders Manager for WooCommerce

Custom Stock Status for WooCommerce

Custom Stock Status for WooCommerce

Custom Stock Status for WooCommerce is the most essential plugin for any ecommerce store. It keeps customers up to date with stock statuses of their desired products. With the help of this plugin you can show text or images indicating to the user how much he is saving on this product.

Pre Orders and Backorders Manager for WooCommerce

Pre Orders and Backorders Manager for WooCommerce

Pre Orders and Backorders Manager for WooCommerce allow you to sell your products before releasing/re-stocking them. One of this plugin’s main features is that it can add custom text above the cart button which can potentially solve this problem as well.

Conclusion

Showing “You Save X%” will surely help to boost sales and it can be implemented in a few very easy steps. Fixing this issue programmatically is preferred however, codes do not offer the level of customization that plugins do and also codes don’t offer any additional features as well.

blank

Caesar

A dedicated content writer with a deep interest in e-commerce and website development. His expertise lies in creating content that resonates with audiences and drives growth for online businesses.

Join our newsletter


    Subscribe to Our Newsletters.

    Be the first to get an exclusive offer and the latest news.