WooCommerce: Display Regular & Sale Price @ Cart Table

In my opinion, the WooCommerce Cart table is somewhat confusing. Why isn’t the “sale price” displayed there? Well, this is a mystery!

I’m pretty confident that showing the “slashed” price would actually help your conversion rate.

So, what about 10 PHP lines in exchange for an increase in sales? Great! Here’s the snippet 🙂

WooCommerce: show sale prices @ Cart Table
WooCommerce: show sale prices @ Cart Table

PHP Snippet: Display Regular/Sale Price in the Cart Table @ WooCommerce Cart

 * @snippet       Show Regular/Sale Price @ WooCommerce Cart Table
 * @how-to        Get CustomizeWoo.com FREE
 * @author        Rodolfo Melogli
 * @testedwith    WooCommerce 3.8
 * @donate $9     https://businessbloomer.com/bloomer-armada/
add_filter( 'woocommerce_cart_item_price', 'bbloomer_change_cart_table_price_display', 30, 3 );
function bbloomer_change_cart_table_price_display( $price, $values, $cart_item_key ) {
   $slashed_price = $values['data']->get_price_html();
   $is_on_sale = $values['data']->is_on_sale();
   if ( $is_on_sale ) {
      $price = $slashed_price;
   return $price;

Where to add this snippet?

You can place PHP snippets at the bottom of your child theme functions.php file (before "?>" if you have it). CSS, on the other hand, goes in your child theme style.css file. Make sure you know what you are doing when editing such files - if you need more guidance, please take a look at my free video tutorial "Where to Place WooCommerce Customization?"

Does this snippet (still) work?

Please let me know in the comments if everything worked as expected. I would be happy to revise the snippet if you report otherwise (please provide screenshots). I have tested this code with Storefront theme, the WooCommerce version listed above and a WordPress-friendly hosting on PHP 7+.

If you think this code saved you time & money, please join other Business Bloomer supporters and avail of 365 days of WooCommerce benefits. Thank you in advance :)

Need Help with WooCommerce Customization?

Check out these free video tutorials. You can start learning how to customize WooCommerce without unnecessary plugins. Watch me code and learn by example!

  • how-to-edit-woocommerce-with-php-snippets
  • woocommerce-hooks-add_action-list-visual
  • woocommerce-customize-single-product-page-PHP

Rodolfo Melogli

Author, WooCommerce expert and WordCamp speaker, Rodolfo has worked as a WooCommerce freelancer since 2011. His goal is to help entrepreneurs and developers overcome their WooCommerce nightmares. Rodolfo loves travelling, chasing tennis & soccer balls and, of course, wood fired oven pizza.

36 thoughts on “WooCommerce: Display Regular & Sale Price @ Cart Table

  1. Hi,

    Old post … but this did not work for me at all. No change to the order review area. Perhaps newer version of WC is the issue.

    1. Works perfectly for me Ryan – sorry 😐

  2. Hi Rodolfo,

    Thanks for this great blog post. I tried your code and it worked.
    however, in the dropdown box of the cart from the head menu, the client now see two prices. ‘
    The original and discount.

    Shouldnt this dropdown box show the end price?

    1. Maybe yes this snippet might need a tweak to make it compatible with the cart widget. I’m afraid it’s custom work. If you’d like to get a quote, feel free to contact me here. Thanks a lot for your understanding!

  3. Hi Rodolfo,

    This snippet works only partially for me. While the initial price is now visible as intended it is displayed without being slashed. My only CSS affects color & weight. Do you have any idea of what could be wrong ?

    1. Hey Thibault, thanks for your comment! Somewhere in your CSS there is probably a call that targets “del” (a slashed part) and hides the slash. Maybe 🙂 Unfortunately this is custom to your theme so I can’t help here. Thanks!

  4. hi sir, i want to Underline the original price and lead price in woocommerce, can you help me?

    1. Hey Sitranet, thanks so much for your comment! Yes, this is possible – but unfortunately this is custom work and I cannot provide a complementary solution here via the blog comments. Thanks a lot for your understanding! ~R

  5. How do I add this to the checkout page also?

    1. Hello Mathias, thanks so much for your comment! Yes, this is possible – but unfortunately this is custom work and I cannot provide a complementary solution here via the blog comments. Thanks a lot for your understanding! ~R

  6. How can I remove it from checkout page?

  7. Awesome, just what I needed :), works perfectly.

  8. This worked perfectly! Even on Woocommerce 3.0 Thanks Rodolfo!

    1. Awesome, thank you Kodi!

  9. Hi,

    The code do not work on my site

    It might due to dynamic pricing which discounted price on quantity discount.

    Possible to show on 1 quantity product?



    1. Hey Allan, thanks for your comment! This snippet is only compatible with default WooCommerce – in your case you will need custom coding and I can’t help here via the comments 🙂

  10. Hi Rodolfo,

    I’d like to display the sale price of a product before the regular (discount) price. I know this has something to do with get_price_html. By default, this outputs something like:

    regular price
    sale price

    I want to change the output so it looks like this (basically, the two prices are shown in a different order):

    sale price
    regular price

    How can I do this?

    Thank you!

    1. Hey Toggy thanks for your comment! Is this on the Cart page or on every page of the website?

    2. Thanks for your quick response. I want on every page of the website.

      1. Oh – I see 🙂 Yes, this is possible but unfortunately it is custom work and cannot give a complementary solution here on the blog. Hopefully I will have time to create a snippet soon 🙂 Thank you for your understanding!

  11. Stupid question… but what file do I copy and paste these 10 lines into? Where in the file? Do I remove anything else out?

    1. Hey Andy, thanks so much for your comment and this is definitely not a stupid question! You can place this in your child theme’s functions.php file – if you need more guidance, please take a look at this video tutorial: https://businessbloomer.com/woocommerce-customization-hangout/

      1. Thanks for your quick response. Can I add it ANYWHERE in the file, and do I need to remove anything?

        1. Hey Andrew – yes you can add it anywhere but I recommend to put it at the very bottom, before the closing line “?>” if it’s there. You don’t need to remove anything 🙂

          If it’s the first time for you, make sure you have a backup of your functions.php and FTP access so you can fix things immediately if anything goes wrong.

          Hope this helps!

  12. how to display regular price and sale price both in cart-totals.php and order page

  13. Hello, how can you do this in the backend and in the emails that go out? Currently if the email goes out to our warehouse, they dont know if it has been discounted and only see £7.99 when the regular price is £9.99

    1. Hey Daniel, thanks for your comment! Yes, I took a look at the WooCommerce files and indeed Emails and Thank you page have different filters than the Cart page. I’m afraid I cannot provide a complementary fix here on the blog but I recommend you take a look at the order-details-item.php file in the templates folder 🙂 Hope this helps!

      1. Thanks for the support, do you find it strange that it reports the discounts across emails, 3rd party invoice software and the like when using the coupon system as standard, but doesn’t report this using the ‘sale discount’ system when selling one item?

        1. Yes! I agree with you 🙂

  14. Hi Rodolfo,

    How do I style these value (price sale, slashed price) , like make it bold and smaller for example.

    I tried to put the “strong” tag on your code but somehow it didnt work.

    Thank you

    1. Hey Drake, thanks for your feedback! So, to add a style to the price you’d need to “inspect element” or use “firebug” depending on what browser you need. Those prices should have a CSS class and you can then use that in your custom.CSS. If you don’t know the basics of CSS I strongly recommend to take a look at http://www.w3schools.com/css/ because CSS is a LOT of fun! Let me know 🙂

Questions? Feedback? Support? Leave your Comment Now!

If you are writing code, please wrap it between: [php]code_here[/php]. Failure to complying with this (as well as going off topic) will result in comment deletion. You should expect a reply in about a week - this is a popular blog but I need to get paid work done first. Please consider joining #BloomerArmada to ask me 1-to-1 WooCommerce questions. Thank you :)

Your email address will not be published. Required fields are marked *