2

I'm using the following code in my theme functions.php to add product images in order email. But the image is not showing in the email. Did I miss anything? I'm using WooCommerce 3.1

function sww_add_images_woocommerce_emails( $output, $order ) {

    // set a flag so we don't recursively call this filter
    static $run = 0;

    // if we've already run this filter, bail out
    if ( $run ) {
        return $output;
    }

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

    // increment our flag so we don't run again
    $run++;

    // if first run, give WooComm our updated table
    return $order->email_order_items_table( $args );
}
add_filter( 'woocommerce_email_order_items_table', 'sww_add_images_woocommerce_emails', 10, 2 ); 
  • Downvote for this question? – Zhenyu Jul 28 '17 at 7:33
3

Try this code in functions.php inside your theme folder.

add_filter( 'woocommerce_email_order_items_args', 'iconic_email_order_items_args', 10, 1 );

function iconic_email_order_items_args( $args ) {

    $args['show_image'] = true;

    return $args;

}
|improve this answer|||||
  • This will display images in a tiny thumbnail format, you can specify the image size using the following code $args['image_size'] = array( 100, 100 ); – Clain Dsilva Feb 8 '19 at 4:04

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.