When WooCommerce sends order emails to your customers, by default it only includes the product name in the order items table within the email.

WooCommerce default email order items

However, it’s possible to add some additional product details here, such as the product SKU or product featured image.

We’d previously written about adding information to WooCommerce order emails so that you could show product SKUs or product images within the WooCommerce order emails for customers. However, the process to do this was changed in a backwards-incompatible way in WooCommerce 2.5.

In previous versions of WooCommerce you were able to filter the entire email output, which made it possible to change whether images or SKUs were included.

However, with WooCommerce 2.5, the filter to change the order items table is still there, but it does not give you all of the data you need to make changes to the order items table in the email in the same way. You don’t have access to the $args that are used in the template to determine what information to show or hide, so this filter pretty much doesn’t allow you to do anything directly.

If you’re already using WooCommerce 2.5, it’s possible to change the information shown in WooCommerce emails, we just have to be a bit more creative in how we use this filter. If you follow this tutorial, be sure you know how to add custom code to your website and that you’re using WooCommerce 2.5 or newer.

Add Product Images to WooCommerce Order Emails

You can add product images to to your order emails with this filter, but we can’t modify the arguments used to get the template directly. Instead, we’ll have to call the $order->email_order_items_table() function again, but with new arguments to use. The reason this gets tricky is because if we call this function, it will call the filter we’re using, which will again call the function, which will again call our filter…you get the idea. We’ll get an infinite loop.

To modify the email output this way, we’ll need to use a static variable as a flag. This will let us only run our code once so that the email output is modified, then our code will bail out after it’s run the first time.

That’s a wrap! This will change the way the email order items table is output to include product images when emails are sent to customers.

WooCommerce order emails with images

Add SKUs to WooCommerce Order Emails

We can use pretty much the exact same code to enable product SKUs in WooCommerce order emails instead of product images.

We’ll use the same snippet as above, but replace:

$args = array(
    'show_image'    => true,
    'image_size'    => array( 100, 100 ),
);

with:

$args = array(
    'show_sku'      => true,
);

This will add the SKU after the product name in this format: Product Name (#productSKU) Here’s an example of what this would look like (the images wouldn’t be there of course):

WooCommerce order emails skus added

WooCommerce Order Emails: Show Both Images & SKUs

You can also add both SKUs and images to the order emails by adjusting the arguments to include both of them. The image size can be deleted if you want to use the default 32px by 32px size, or you can add your own size by adjusting the values below.

$args = array(
    'show_sku'      => true,
    'show_image'    => true,
    'image_size'    => array( 100, 100 ),
);

Add Product Information to WooCommerce Order Emails

Adding product SKUs or product images to WooCommerce order emails is possible, and you can add both if desired, along with changing the size of your image as needed. Remember, the code outlined above is only for WooCommerce 2.5 or newer. If you’re still using an older version of WooCommerce, check out our previous tutorial for code compatible with your WooCommerce version.


Note: This post may contain affiliate links, which means we get a commission from the plugin, theme, or service provider if you choose to purchase. Regardless of this, we are committed to providing high quality, unbiased resources. Have more questions? See our affiliate policy. You can use the plain links below if you prefer that we not receive a referral commission:
Articles you may also like:

Posted by Beka Rice

Beka Rice manages the direction of Sell with WP content and writes or edits most of our articles to share her interests in eCommerce. Or she just writes as an excuse to spend more time jamming out to anything from The Clash to Lady Gaga. Who knows.

25 Comments

  1. Hi Beka,

    Very interesting read, thank you! Will be looking to implement this.
    Would you know a way to change the email so you have the PPP, number of products and total price?

    For example:
    Product Quantity PPP Total
    Ninja hoodie 2 $10 $20

    Reply

    1. Afraid you’d need to override the order items and order details templates to add new columns, no easy hooks in place for this.

      Reply

  2. I have just tried this, and it works perfect on the email send to the shop-owner, but the mail send to the customer is still without images. Do you have any idea what could be wrong here?

    I added the code to functions.php in my child theme.

    Reply

    1. Afraid not, I’d used this exact code in my test for customer emails so something else may be altering the email templates after this code runs.

      Reply

  3. Thanks for this! I added the snippet for SKU and Image…both are displaying in my back end confirmation email, but not the customer email. Meaning, when I receive an order, I see the image and SKU, but the customer isn’t seeing either in their confirmation. Any insight? Thanks again!!!

    Reply

  4. Is there a way to have the SKU on its own line?

    Reply

    1. There’s a snippet at the bottom of this section that should do the trick.

      Reply

  5. Great, worked perfectly. Thanks!!

    Reply

  6. Hey there. How can I use your code to only add the sku? Most of the code involves calling in imagery…which we didn’t want.

    Also, how would we output the order number into the body of the email like it used to? Now it only displays in the email subject line. Much appreciated!

    Reply

    1. The instructions here cover adding SKUs. As for order numbers, this should still be included in every email unless you’re overriding whether it’s sent to an admin or not.

      Reply

  7. Hello,

    Thanks for this useful guide. It worked great on the admin email, however just like the 2 people above in the comments, this did not apply to the customer confirmation email. Any help would be much appreciated.

    Reply

    1. I tested this with customer emails and it worked as expected for me on a vanilla, so I’m not sure what else is going on with emails that would cause this for some people. Regardless, WC 2.6 adds a much-needed filter to make this simple again, so I’ll be publishing an updated post once WC 2.6 is out — keep an eye out 🙂

      Reply

  8. Hello!

    I need to display the category of the purchached product in my email-order-details.php

    Please can you help me?

    tnnx

    Reply

  9. Hello, like many others I experience the same, where product photos show in admin email, but not for customers. I have tried to find info about this in 2.6, as you mentioned it has a new filter to make this easy. Any chance you could shed a bit more light on this`?

    Reply

      1. Excellent Beka, I tried to find this article, but obviously didn’t search very well. Have now updated the code and all is working how I want it. Thanks for your help!

        Reply

  10. Hi Beka,

    I know I’m late to the party on this one, but wondering if you can help! I’m wondering if you know what the merge tag would be to display a certain attribute? I’ve created custom templates for my emails, which are working great, but I’ve had some requests from customers to show the “size” attribute.

    All the info is taken care of with merge tags from this document: https://docs.woocommerce.com/document/automated-follow-up-emails-docs/email-variables-and-merge-tags/

    but I can’t work out what the tag would be for an attribute.

    Any help would be much appreciated!

    Reply

  11. Hi Beka,

    I am afraid this does not work.

    Exactly as others mentioned, this will affect only email send to shop admin, not the one we actually want to modify, the one send to customer.

    I don’t have any plugin installed which I am aware that it would modify email…

    But there is a good news.
    Your old manual works flawlessly.
    Link: https://www.sellwithwp.com/how-to-add-information-to-woocommerce-emails/

    Hope this helps others…
    Regards
    Jan

    Reply

  12. Muhammad Jibran Alam April 18, 2017 at 9:15 am

    I never seen such a beauty in content and explaining thing. Really it compel me to write review.

    This is called quality of work which catch the eye of the reader and put good impression in their mind. I really like your article about image in woocommerce email. really i need same thing. I have no word for your this article, SUPERB.

    Reply

  13. Is it also possible this way to add links to the product within the order confirmation email?

    I would like the customer to be able to click on the link in the order confirmation, which should automatically open the customers browser and then show the product he bought.

    Thanks 🙂

    Reply

    1. The only sample code I have for this requires WC 3.0+ or newer, and can be found here.

      Reply

  14. Thank you very much for your answer Beka. Appreciate it a lot 🙂 Best regards – Anders

    Reply

  15. Hi, in which file i’ll have put function code to put images products in email?

    Thanks

    Reply

  16. Thanks for helpful article.
    How i can re-arrange position for Product Title and SKU like ” SKU | Product Title ” ?

    Reply

Leave a reply

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