Answer the question
In order to leave comments, you need to log in
How to add product image and short description to Woocommerce emails?
Such code is written in functions.php, but the picture does not appear, only an empty space, and its size is 32x32.
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( 500, 500 ),
);
// 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 );
Answer the question
In order to leave comments, you need to log in
Unfortunately, you won’t get support and answers on our forums)
I didn’t understand how I got pictures in letters, but I added a brief description like this.
In functions.php
add_action( 'woocommerce_order_item_meta_start', 'dw_order_item_meta_start', 10, 4 );
function dw_order_item_meta_start( $item_id, $item, $order, $plain_text ){
$description = $item->get_product()->get_short_description();
if(!empty($description)) {
echo " ({$description})";
}
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question