Are you running a WooCommerce store and want to boost your sales conversions? One simple but effective way to encourage customers to complete their purchases is by clearly showing how much they save. Displaying the total discount amount and savings right on the Cart and Checkout pages can increase customer trust and reduce cart abandonment.

In this tutorial, I’ll share a lightweight PHP snippet that shows your customers exactly how much money they’re saving combining both product sale discounts and coupon discounts directly on your WooCommerce Cart and Checkout pages.

Why Display Total Savings on WooCommerce Cart and Checkout?

Showing total savings benefits your WooCommerce store by:

  • Increasing Sales Conversion: When customers see their total discount, they’re more motivated to finalize their order.
  • Building Customer Trust: Transparency in pricing reassures customers they are getting a good deal.
  • Reducing Cart Abandonment: Highlighting savings can reduce hesitation and drop-offs during checkout.

WooCommerce Total Discount: What Does It Include?

This snippet calculates the total savings by combining:

  • Sale Price Discounts: The difference between regular prices and sale prices for products in the cart.
  • Coupon Discounts: Any active coupon reductions applied by the customer.

Together, these show a complete picture of the customer’s savings in real-time.

How to Add Total Savings to Your WooCommerce Cart and Checkout Pages

Step 1: Add the PHP Snippet to Your Site

Copy and paste the following code into your child theme’s functions.php file or use a plugin like Code Snippets to safely add custom PHP:

/**
 * Display total discount and savings on WooCommerce Cart and Checkout pages
 * Works with WooCommerce 8 and above
 */

add_action( 'woocommerce_cart_totals_after_order_total', 'bbloomer_show_total_discount_cart_checkout', 9999 );
add_action( 'woocommerce_review_order_after_order_total', 'bbloomer_show_total_discount_cart_checkout', 9999 );

function bbloomer_show_total_discount_cart_checkout() {   
   $discount_total = 0;  
   
   foreach ( WC()->cart->get_cart() as $cart_item_key => $values ) {         
      $product = $values['data'];
      if ( $product->is_on_sale() ) {
         $regular_price = (float) $product->get_regular_price();
         $sale_price    = (float) $product->get_sale_price();
         $quantity      = (int) $values['quantity'];
         
         $discount = ( $regular_price - $sale_price ) * $quantity;
         $discount_total += $discount;
      }
   }          

   $coupon_discount = WC()->cart->get_discount_total();
   $total_savings   = $discount_total + $coupon_discount;

   if ( $total_savings > 0 ) {
      echo '<tr><th>You Saved</th><td data-title="You Saved">' . wc_price( $total_savings ) . '</td></tr>';
   }
}

Step 2: Verify the Result on Cart and Checkout

After adding the code, visit your WooCommerce Cart and Checkout pages. If there are products on sale or coupons applied, you will see a new line displaying:

You Saved: $XX.XX

This dynamically updates based on the customer’s cart contents and applied coupons.

Important Notes

  • This snippet is tested with WooCommerce version 8 and above.
  • It only calculates savings from sale prices and coupon discounts. Other types of discounts (like manual price overrides) may not be included.

Boost Your WooCommerce Store Today

Showing your customers how much they save builds transparency, trust, and urgency. Use this snippet to enhance your WooCommerce store’s Cart and Checkout experience and watch your conversion rates improve.

If you want more WooCommerce tips, tutorials, and code snippets, subscribe to Business Bloomer for regular updates!