Print the unit price in the emails

Some months ago I wrote a post about how to add the unit price in the checkout page.
It would be useful though to have the same unit price also in the emails sent both to the admin and to the customer.

Doing this it’s harder than what we did for the checkout page.
There are more templates to tweak and we also have to consider both plain and HTML emails.

But it’s not impossible, obviously.

Download “Unit price in the emails”

emails.zip – Downloaded 5445 times – 7.79 KB

Download the zip above, then extract it. You will have a folder names emails in your computer. Copy that folder and put it in wp-content/themes/your-theme-name/woocommerce/.

Note: If you are using a custom theme which already overrides the emails templates be careful. This may break your theme. Contact the theme author before to override the templates.

Download “Unit price in the emails”

emails.zip – Downloaded 5445 times – 7.79 KB

Contribute to Improving This Blog

Did you enjoy this article? Was it helpful? Contribute to help me writing more articles! The funds collected from this blog are reinvested directly into improving my skills or the blog so that I can provide more and better content!

One-Time
Monthly
Yearly

Make a one-time donation

Make a monthly donation

Make a yearly donation

Choose an amount

¤5.00
¤15.00
¤100.00
¤5.00
¤15.00
¤100.00
¤5.00
¤15.00
¤100.00

Or enter a custom amount


Your contribution is appreciated.

Your contribution is appreciated.

Your contribution is appreciated.

DonateDonate monthlyDonate yearly

Do you prefer using cryptocurrency? I’ve got you covered! You can donate at the following wallets:

  • BTC: bc1q87nxpdpqw323ccmerrzyeffs72wnxpw93x7pzk / 17Gtc5e8yoh2LZzokoyK8P5DWbToBwztok
  • ETH: 0xA5C89Be1df2896C3942DBEf751cCeacC7929388b


More Posts That You Might Like…


68 responses to “Print the unit price in the emails”

  1. Thank you sooooo much! This is great! There just one little thing. Its in the wrong order for me, please see the image I’m linking to you:

    https://www.dropbox.com/s/lihy9cb479m7m00/Screen%20Shot%202015-09-08%20at%2010.59.02%20AM.png?dl=0

    1. Hi Crystal, what email is that exactly? I may have missed to add some code in the zip, sorry.

      1. I’m sorry, it was in the woocommerce-quotation plugin. I had to add in an

        After that worked and was in the correct order.

        Thank you for your help, this should really be part of Woocommerce as a default function. It just makes sense.

  2. Dear Nicola, excellent post thank you. Is there a way to transform this into an invoice by adding the sequential number of invoice too?

    1. HI Viviana,
      Sorry for the very late reply!

      Technically yes, it is possible. You need to add the code to print the number. I’m not sure what to add because it depends on the Invoicing plugin you are using.

  3. Hi Nicola, it’s not working for me unfortunately.
    I’ve put the file in the child-theme/woocommerce folder and then in the maintheme/woocommerce folder – both extracted of course!
    Not sure what I’m doing wrong unless this fix if pre Woocommerve 2.5?
    I have WC 2.5.5

    1. Hi Rob,
      I just tested this on WooCommerce 2.6.1 and it works. I guess it works also for the 2.5 since the templates are the same!

      Make sure that you are pasting the whole emails folder in child-theme/woocommerce/, and not only the files inside the folder.

  4. its great …Thanks for this . i have the same issue as Crystal . the columns are switched. quantity has the prices and the Price column has the quantities..
    it will great if get the fix .
    thanks . HOve

    1. Hi Hove,
      Can you please try to disable the theme/plugins? For Crystal it was a conflict with another plugin.

      It is still working properly for me.

  5. Does this work with WooCommerce 3.6.6? I am nervous about replacing the “whole folder” since your folder has about half the .php files as the current version.

    1. Hi Laura,
      Thanks for reporting. I’ll have to update the templates, but the difference is very small. I simply add a new row in the table. You can open the files from my zip, copy the differences and add them to your templates from the 2.6.6.

      I’ll update the zip in this article as soon as I can.

  6. Lyse Tremblay Avatar

    Hi Nicola,

    Thank you so very much for sharing. It works very nicely. However, if an order is fails, I need also the customized order table. Do you have a updated file for this condition that you could share?

    In addition to that, is there an easy way to add a block of text at the top to include the seller company contact information and to move the customer details above the order items table?

    Regards
    Lyse

  7. hello..
    Can someone tell me how I can translate the title Unit Price after insert the file?
    Thank you in advance.
    Haris

    1. Hi Haris,
      You can do it with Loco Translate or just write it in the language that you want to use directly in the code.

  8. Hi Nicola,

    With WooCommerce v3.0, two templates were modified: email-order-items.php one located in the emails folder the other in the plain folder.

    Are you planning to update your templates to WC version 3.0? That would be very nice.

    Thanks
    Lyse

    1. Yes Lyse, I’ll update them!

  9. Hi Nicola,

    Please let me know when they are ready for download. Thank you for responding quickly.

    Lyse

  10. Hi Nicola,
    I have to upgrade to WooCommce v3.0 now, so I looked at updating the two templates myself but one of them is giving grief because the new version appears to be stripping tags which your template has and I’m not knowledgeable enough to understand the implications and risk I would be taking guessing what these will do or counter react.

    Any ETA as to when you would have the time to look at these two templates only? The more difficult one for me is the the file in the plain folder.

    Much appreciated
    Lyse

    1. Hi Lyse,
      I updated the templates.

  11. Hi Nicola,

    Thank you so much for updating the templates so quickly. All works very well.

    Lyse

    1. You’re welcome Lyse!

  12. Hello I’m using custom plugin for email templates (Email costomizer) how can I add price per unit in my email template?
    THANKS!

    If you want I can send you the template to see if you can

    1. Hey Koray,
      I’m sorry but I don’t know that plugin, you should ask to the author.

  13. Hi Nicola,
    I have upgraded to WooCommerce v3.2.1 now, and it looks like three templates have been updated. I was wondering if you could update your templates to reflect the new WooCommerce changes. The templates that have changed are:

    woocommerce/emails/email-order-details.php version 3.0.0 is out of date. The core version is 3.2.0,
    woocommerce/emails/email-order-items.php version 3.0.0 is out of date. The core version is 3.2.0,
    /woocommerce/emails/plain/email-order-items.php version 3.0.0 is out of date. The core version is 3.2.0

    I had a look at updating these myself but I’m a little confused with the new changes.

    Any ETA as to when you would have the time to look at these templates?

    Much appreciated
    Lyse

    1. Hi Nicola,
      Do you have an ETA on when you may be able to provide updated templates?
      Thanks
      Lyse

      1. I’ve updated the files now!

  14. Is there a way to not add discount to the unit price? When I have a discount it shows discount applied instead of just unit price.

    1. In the templates you will find this code:

      <?php echo wc_price( $order->get_item_total( $item, false, true ), array( 'currency' => $order->get_order_currency() ) ); ?>
      

      Replace that get_item_total with get_item_subtotal.

      1. Perfect! Thank you!

        1. You’re welcome!

  15. Thank you so much for this, I have been trying to solve this issue for a client for a few weeks now with no joy.
    This worked fantastic, I had to make a small adjustment as the subtotals, tax etc where showing in col 2 which looked untidy so simply changed this to col 3 to achieve.
    Thanks again!!

    1. You’re welcome, Vicky!

  16. Amazing!!! Thank you!

    1. You’re welcome Radim!

    2. One question: How to show if variable product – SKU of product instead of SKU of variation?

      1. You can change the SKU that is shown in the template email-order-items.php.

        The code that you need to edit is this:

        // SKU
        if ( $show_sku && is_object( $product ) && $product->get_sku() ) {
            echo ' (#' . $product->get_sku() . ')';
        }
        
  17. Thank you so much. Working on WP 4.9.

    Only 1 thing:

    In the total, and shipping mode columuns has to be colspan=”3″

    <th class=”td” scope=”row” colspan=”3″”>

    1. Thanks! Fixed it.

  18. Hi Nicola
    There is now a revised 3.4.0 version of the email-order-items.php and yours is still at version 3.2.0 after I download it.

    Do you have an update of your files available download?

    Thanks
    Lyse

    1. Updated! Thanks for reporting!
      The plain emails version is still 3.2.0 as per WooCommerce core.

  19. Oh man you just saved my day! I was looking for something like this for about 2 days straight.
    Downloaded the files and uploaded them to the right folder and it works right away. Only thing i had to change was the column thing, but that was easy enough..

    BTW since today (nov, 1st) the template is out of date since there’s a 3.5.0 core version, I didn’t test if it’s still working, but i thought i let you know!

  20. Print the price per item only in the letter for the store. What file to use?

  21. Thanksssssssssssssssssssssss so much 🙂 I’ve been looking for it for a long time.

  22. Hi Nicola,

    I just noticed in the last month that some product images display in the emails and sometimes they don’t. I’ve talked to a WooCommerce support representative about this and because I use customization, they can’t provide support on this issue.

    Here’s the code used in the “order-email-details.php” file:

    tbody
    ?php
    echo wc_get_email_order_items( $order, array( // WPCS: XSS ok.
    ‘show_sku’ => $sent_to_admin,
    ‘show_image’ => false,
    ‘image_size’ => array( 32, 32 ),
    ‘plain_text’ => $plain_text,
    ‘sent_to_admin’ => $sent_to_admin,
    ) ); ?
    /tbody

    Can you help with my issue of the product images not displaying in emails?

    Thanks
    Lyse

  23. Hello from me. I tried to use your files try to print Unit price in order emails. In the middle of the table where was written the products, the info for price appear, but in header of the table and in footer with totals – no changes! Where must be the problem?

  24. Hello Nicola,
    Great changes in the order-details and items.
    Just what I needed.
    Unfortunately I get some html code in the emails. Like also some extra spacing in the unit price and a ; symbol in the price.
    Any idea where I should look?

  25. Thank you for your code, but we are using WP 5.2 and Woocommerce 3.6.4 and under “Unit Price” all we get is $0.00.
    Does your code work with these versions?

    Thank you,
    Todd

  26. I don’t know if you are still monitoring this blog, but if you are we would be more than happy to pay you for a solution to our needs!!!!!!!!!!!

    Thank you for your code, but we are using WP 5.2 and Woocommerce 3.6.4 and under “Unit Price” all we get is $0.00.
    Does your code work with these versions?

    Thank you,
    Todd

  27. Thanks for this! really helpful.
    But is there a way to show the unit price as tax included price?
    As of now each product unit price on the 2nd column shows tax excluded price and subtotal on the last column is included.

    1. Nevermind. I figured it out!
      In case someone run into same issue as me,
      Instead of using
      <?php echo wc_price( $order->get_item_total( $item, false, true ) at line 67,
      replace ‘false’ after $item to ‘true’ to get tax included value.
      <?php echo wc_price( $order->get_item_total( $item, true, true )

  28. Hi there! that is amazing and should be a standard setup from woocommerce. You are great. Quick question: Do your files still work now in 2019 or are the templates outdated?

  29. This worked as expected for WordPress 5.3

  30. I tried this, and the unit price shows up in the emails, but on closer look, I see that the columns do not line up correctly. The product row has 4 columns, but the rows below it still only have 3 columns (in Subtotal, Payment Method, and Total). See https://www.dropbox.com/s/b9vr58nes0muicg/Screenshot%202019-11-18%2014.23.37.png?dl=0

  31. hello! Thanks for help. Maybe you can tell how can I manage order? q-ty, unit price, price
    I can manage table heading, not email array

  32. Call by Price in Woocommerce if you out of stock woocommerce product for need to get enquiry than you can be using call by price in woocommerce

  33. Download link not working

  34. Download link not working

  35. I was able to do it, but the labelling of the columns were switched. Quantity column shows unit price, Price column shows quantity and the total has no label. The subtotal is also in column 2, instead of column 3. Check out the image here: https://www.dropbox.com/s/ese5m17u19htnqq/Screen%20Shot%202020-05-02%20at%202.38.56%20PM.png?dl=0

    I tried disabling plugins but it didn’t work too. May I know which file do I edit to fix this? Thanks!

  36. Great resource. Thank you for posting it!

  37. Would be great if you could explain what’s done in the files! I could not figure it out. Does it just work by adding the column I haven’t been able to see the code that `echo` the value. Thank you!

  38. Absolutely works on 14th Jan 2021! Thank you a million

  39. I’ve tried it and it works but WP throws back a notification that the templates need to be updated. Anyone else get that? Is there an updated template?

  40. Hi, I am using your files, it works just great but it is displaying the price without tax and I need to have the unit price shown+VAT. Can you help me?

  41. Excellent work. Thank you for contributing to the Woo community.

  42. Hi Thanks for the files 🙂 Are these still compatible with the current version of WooCommerce?

    1. Hey Gary, I am sorry but I did not test this with the most recent versions of WooCommerce. They might work.

Leave a Reply

Categories

Newsletter

Receive new articles from this blog directly in your inbox!

No spam guaranteed!

Blog at WordPress.com.

%d bloggers like this: