Show SKUs or photos in WooCommerce emails

Your WooCommerce order emails bridge the time between your customer leaving your store (after placing an order), and the customer receiving an order. As such, they’re an extension of the shopping experience for your customers, and provide the primary means for keeping a customer updated about the order’s status.

As such, many merchants want to ensure their WooCommerce emails accurately reflect the customer’s order, answer any questions customers may have after purchasing, and help to maintain a positive shopping experience overall.

One way you can ensure that order emails provide the details customers want is to add more item information. For example, our purchase receipt case study described how product photos and other information confirm for customers they ordered the exact items they meant to. While additional details like the product photo or SKU are not present in WooCommerce emails, we can add them.

Didn’t you write this already?

Indeed we did smile The WooCommerce order items table has evolved a lot over the past few releases of WooCommerce.

Modifying the email order items prior to, and including, version 2.4 was fairly straight forward. You were able to filter the entire order items table HTML, and thus could just rebuild the items table with your own changes (such as changing the “show SKU” value to true).

However, WooCommerce 2.5 made this far more difficult because you no longer had access to all of the variables needed to re-build the order items table. Since you didn’t have the order object, you couldn’t easily change the order items display with the same filter while keeping other values correct. We had put together a workaround for version 2.5, but this wasn’t a great approach to solving the problem and didn’t always work depending on the email being sent.

WooCommerce 2.6 fixes the issue by adding a more useful filter — the woocommerce_email_order_items_args filter — to the order items table within emails, which we can use to make modifying your WooCommerce emails simpler.

Checking for customer vs. admin WooCommerce emails

This part is entirely optional. The woocommerce_email_order_items_args gives you access to a set of arguments ($args) that you can check or modify as needed.

Sometimes you want to modify only admin or customer-facing emails, so you can check the $args['sent_to_admin'] value to do so. To only change customer emails, bail out of this is set:

// only change customer emails
if ( $args['sent_to_admin'] ) {
    return $args; 

To only change admin emails, do the reverse:

// only change admin emails
if ( ! $args['sent_to_admin'] ) {
    return $args; 

Our last example in this tutorial will show a full snippet that only adds product images and SKUs to customer-facing emails.

Add SKUs to WooCommerce emails

In order to show SKUs in your order emails, you’ll need to change the $args['show_sku'] value in the order items table. We can do so very easily:

 * Adds SKUs and product images to WooCommerce order emails
function sww_add_sku_to_wc_emails( $args ) {
    $args['show_sku'] = true;
    return $args;
add_filter( 'woocommerce_email_order_items_args', 'sww_add_sku_to_wc_emails' );

This will add SKUs right next to your product names in the order items display.

WooCommerce Emails: order email item SKUs displayed
SKUs added

Add product photos to WooCommerce emails

In a similar fashion, we can change the $args['show_image'] to determine whether product images are shown in WooCommerce emails or not. We’ll set this to true to show a 32px product image in your emails.

 * Adds product images to WooCommerce order emails
function sww_add_photos_to_wc_emails( $args ) {
    $args['show_image'] = true;
    return $args;
add_filter( 'woocommerce_email_order_items_args', 'sww_add_photos_to_wc_emails' );
WooCommerce Emails: order email item photos displayed
Product Photos added

Change product photo size in WooCommerce emails

Let’s put all of the tips above together, and add a last one. The product photo in the above example is kind of small — not really enough detail to satisfy most customers. We’ll make several modifications here:

  1. only change emails sent to customers, not admins
  2. add item SKUs
  3. add product images to the email
  4. modify the image size — we’ll use a 100px by 100px image instead

The last part can be done by modifying the $args['image_size'] value.

 * Adds SKUs and product images to WooCommerce order emails
function sww_modify_wc_order_emails( $args ) {
    // bail if this is sent to the admin
    if ( $args['sent_to_admin'] ) {
        return $args; 
    $args['show_sku'] = true;
    $args['show_image'] = true;
    $args['image_size'] = array( 100, 100 );
    return $args;
add_filter( 'woocommerce_email_order_items_args', 'sww_modify_wc_order_emails' );
WooCommerce Emails: order email item photos and SKUs displayed

You’ll use an array() for the image size, setting the dimensions to new values: array( width, height )

Advanced changes to WooCommerce emails: For developers

Finally, developers with a more complete understanding of PHP and WordPress can make some more advanced changes. If you want to conditionally make changes to WooCommerce emails, you’ll have access to the WC_Order object with this filter:


This could let you make checks on the order before changing the order items table display. You can also loop through the order’s line items as you have access to:


For example, if you only wanted to show purchase notes for completed orders (rather than for any paid order), you could do something like this:

$args['show_purchase_note'] = false;

if ( $args['order']->has_status( 'completed' ) && ! $args['sent_to_admin'] ) {
    $args['show_purchase_note'] = true;

Customizing WooCommerce email display

Making small improvements to WooCommerce emails is straightforward with some basic knowledge of PHP and WordPress hooks. Just be sure you know how to properly add code to your site to make changes like this, and always test on a staging site if you have one!


  1. Hi Beka,

    Thanks for the article.

    Quick Question – I want to display sku and product image in the email sent to the customer, and have used your code below in the previous tutorial you posted on this subject:

    [ removed ]

    This works perfectly, but only the emails sent to admin display the required fields.

    I see that you have added a new snippet on how to get this to display on customer emails, but I am not too sure where to add this in? Could you please clarify this for me?

    Thank you so much in advance!

  2. Hi,

    I’ve tried this code and the other article you kindly wrote for 2.5. I am getting the same results as in the admin gets the pictures but the customer email still doesn’t. As you said there is something modifying the table afterwards but not sure what this is as of yet. Have you found anything that could be interfering with the process?

  3. How do I change the “Shipping” text to something else in the order emails? For instance – “Shipping & Handling”. I can’t find locate this code anywhere in the woocommerce plugin.

  4. Thanks for the great article. I have followed your code to add product images to email using a custom plugin. But instead of image i see only a text “product image”. On inspecting i can see tag without src attribute.

  5. Thank you for such a well written tutorial! Very helpful in the customizations I was needing to do.

  6. Thank you for a great tutorial. It worked fine for me and this was after finding many other online “solutions” that did not work.

  7. i want to show product weight after product title in new order emails can you please help

  8. I’m curious to know if this is still good and if so is anyone seeing a fatal error in logs? Ever since adding this I see “CRITICAL syntax error, unexpected ‘endif’ (T_ENDIF), expecting end of file in” /customer-completed-order.php

    Since you’re using an If Statement it appears it may not be closing in the email itself. No?

      1. Thanks. I’d rather not have to add anymore plugins then I have to. This script works and I have it inside my child theme. Just curious as to why it’s triggering this error.

        1. Hey Stef, I’m afraid I can’t replicate this when using Code Snippets or the functions.php file for this snippet — sounds like perhaps the entire thing hasn’t been copied over correctly? From my end this functions as expected with no PHP warnings or errors.

<em>Hmm, looks like this article is quite old! Its content may be outdated, so comments are now closed.</em>