Woocommerce 3.1 Add product image to order confirmation email not working

I'm using the following code in my theme functions.php to add product images in order email. But the image is not s

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 ); 

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 ); 
Share Improve this question asked Jul 28, 2017 at 4:56 ZhenyuZhenyu 1611 silver badge7 bronze badges 1
  • Downvote for this question? – Zhenyu Commented Jul 28, 2017 at 7:33
Add a comment  | 

1 Answer 1

Reset to default 4

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;

}

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1745126327a4612710.html

相关推荐

  • Woocommerce 3.1 Add product image to order confirmation email not working

    I'm using the following code in my theme functions.php to add product images in order email. But the image is not s

    5小时前
    10

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信