When a new order is placed in WooCommerce, customer receives an email with order items. But it does not include product images. We can add product images to order email using woocommerce_email_order_items_args
filter. We can also control the image sizes to display on the email.
function careless_add_images_to_wc_emails( $args ) {
$args['show_image'] = true;
return $args;
}
add_filter( 'woocommerce_email_order_items_args', 'careless_add_images_to_wc_emails' );
Above code will display product images in order emails. Default image size is 32×32 pixels. If you want a different image size, we can use image_size
array key to define our custom size.
function careless_add_images_to_wc_emails( $args ) {
$args['show_image'] = true;
$args['image_size'] = array( 100, 50 );
return $args;
}
add_filter( 'woocommerce_email_order_items_args', 'careless_add_images_to_wc_emails' );
Code goes in the functions.php
file of your active theme.
Similarly, we can add product SKU to order emails.