WooCommerceWordPress

How to add Image to WooCommerce order emails

0
238
2019 / 10 / 07

In the previous article, we have learned about how to add SKUs to the WooCommerce order emails.

In this article, we will see how to add product image in WooCommerce order emails, sent to the shop manager or site admin.

By default, the WooCommerce order email is very simple. When an order is placed, WooCommerce generates an email to the shop manager. The default representation of order detail is below:

Here you will notice that the products don’t have their featured image in them. To add images we need to add the following PHP snippet in functions.php of your child theme:

// Adds image to WooCommerce order emails
function w3p_add_image_to_wc_emails( $args ) {
    $args['show_image'] = true;
    $args'image_size'] = array( 100, 50 );
    return $args;
}
add_filter( 'woocommerce_email_order_items_args', 'w3p_add_image_to_wc_emails' );

 

Once you allow images to the order email args, the images will become visible in the order emails. For example:

Now, the email becomes a bit interactive by adding images with the products.

In the next article, we will learn how to add product SKU in the order email in WooCommerce.