Sale prices are the most used marketing technique in the world. Its no secret that a good discount on a product can push the customer over the edge of buying the product they wanted to have for a long time, or make the decision easier when they see the discounted product coming by.

In WooCommerce the sale prices are communicated nicely on the product overview and detail pages, but nowhere in the cart or checkout! In this post I’ll show you how you can show the sale prices in the cart and checkout.

Showing sale prices in the cart

With the code snippet below it will show the product price as it does on the product detail page:

After adding the above code snippet your cart should look something like this:

It looks good and nicely emphasises the sale of the items.

One catch; this does not take in account the tax setting ‘Display prices during cart and checkout’, it will instead take the same value as the ‘Display prices in the shop’ setting to show prices including or excluding taxes.
If this is essential for your store you’d need to further customize the code snippet to represent the correct values.

Showing sale prices in the checkout

For the checkout a separate code snippet is needed, I’ve made this code snippet a bit more expanded and it does follow the settings of tax display. Since the checkout by default doesn’t show product prices at all, only the totals, we just integrate it with that and show the old total price, and the new one:

The code snippet is quite a bit longer then the one for the cart, but its doing a lot too. This will in fact take in account the tax settings for the store (remember the catch I mentioned before). This will look like this in the checkout area:

A little side effect of this code snippet is that it will also modify the total price in the cart, since they share the same filter name:


If this is undesired it can be disabled by adding a additional check to the last code snippet, right after the function start

if ( is_cart() ) { return $subtotal; }


Pro conversion tip! Running a store wide (temporary) sale? Remember your customer this is sale price they’re seeing is only available for a small window. This will create a sense of urgency and fear of missing out, making them pull the trigger on the purchases faster.

A message like this can be added dynamically through the Advanced Messages plugin.

Bonus: Show the savings in the totals

Okay, just one last thing you can do.. Showing the total savings at the totals table would be perfect. Nobody likes to do the math while it is interesting to know how much you’re saving in total.

It will look something like this in the end:

I hope you found this post useful. If you found yourself using one or multiple code snippets I’d appreciate if you can leave a comment below 🙂

Jeroen Sormani

I'm a professional WordPress plugin developer on a mission to create the best plugins for my clients. I'm specialised in developing general WordPress, WooCommerce and Easy Digital Downloads plugins.

Interested in talking about a WordPress project? Get in touch!

Follow me on Twitter

5 thoughts on “Showing sale prices in the cart – in WooCommerce

amy December 7, 2017 at 10:37 am

hello, where do i put these codes at?

Jeroen Sormani April 23, 2018 at 8:33 am

Hi Amy,

I’ve written a post here that elaborates how you can add code snippets to your site:


Daniel February 17, 2018 at 2:00 am

Is there any way to place at “Subtotal” too? In the cart sidebar. Just in the “Subtotal”, not the “Total”.

Great code, thanks.

Phil April 3, 2018 at 3:01 am

Thanks for this! I’m wondering if it’s possible to also add this to the order confirmation email?

Philip May 2, 2018 at 11:41 pm

Great 😀 only the checkout scripts results in a PHP error on line 40 somehow..

Leave a Reply