0

I've overridden Woocommerce template file email-order-details to display the product thumbnail in customer's email:

<?php
    echo wc_get_email_order_items( $order, array( // WPCS: XSS ok.
        'show_sku'      => $sent_to_admin,
        'show_image'    => true,
        'image_size'    => array( 100, 100 ),
        'plain_text'    => $plain_text,
        'sent_to_admin' => $sent_to_admin,
    ) );
?>

But only white space is displayed in the received email.

0

You'd better use woocommerce_email_order_items_args filter. It can be done this way:

function add_product_thumbnail_to_wc_emails( $args ) {
    $args['show_image'] = true;
    $args['image_size'] = array( 100, 100 );
    return $args;
}
add_filter( 'woocommerce_email_order_items_args', 'add_product_thumbnail_to_wc_emails' );

The code has to be placed to functions.php

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.