How To Add Images To Order Email: WooCommerce

How to add images to your WooCommerce Customer Order receipt is pretty simple. As you can see below, WooCommerce doesn’t show thumbnails in the New Order form that gets emailed to both you and the customer. I show you how to fix that with this hook.

Without Thumbnails

Customer Email With No Thumbnails

With Thumbnails

Thumbnails Added To New Order Email

The snippet below may not work in all themes when you want to add images. As always, add it to your child theme. If you’re a risk taker and it crashes your site that’s on you. Test in local or staging environments first. If you have any questions comment below and I’ll try and help you out.

function sww_add_photos_to_wc_emails( $args ) {
    
    $args['show_sku'] = false;
    $args['show_image'] = true;
    return $args;
}
add_filter( 'woocommerce_email_order_items_args', 'sww_add_photos_to_wc_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'] = false;
    $args['show_image'] = true;
    $args['image_size'] = array( 70, 70 );
 
    return $args;
}
add_filter( 'woocommerce_email_order_items_args', 'sww_modify_wc_order_emails' );

You’ll want to play around with the thumbnail size. As you can see I have mine set to 70×70. I wouldn’t go any bigger than 100×100. Hope you’ve enjoyed this lesson in how to add images to your WooCommerce store. A nice and professional looking receipt.

There’s a great plugin called Preview E-mails for WooCommerce by Digamber Pradhan that allows you to see the changes after you’ve added the code snippet. This is great so you’re not having to do all these fake orders. However, you do need an order to at least view any email with this plugin.

Comments are held in moderation before posting. Please be patient with me as I am very busy. I don't allow any code to be added. I'll update the comment section soon to allow it though. All spam comments will be filtered out by WordPress automation. So don't even bother you little bot you.

Leave a Reply