Based on Display the product image in Woocommerce email notifications answer code I wrote the following to display the product image in WooCommerce email notifications.
add_filter( 'woocommerce_email_order_items_args', 'custom_email_order_items_args', 10, 1 );
function custom_email_order_items_args( $args ) {
$args['show_image'] = true;
$args['image_size'] = array( 32, 32 );
$args['show_sku'] = true;
return $args;
}
add_filter( 'woocommerce_order_item_thumbnail', 'add_email_order_item_permalink', 10, 2 ); // Product image
add_filter( 'woocommerce_order_item_name', 'add_email_order_item_permalink', 10, 2 ); // Product name
function add_email_order_item_permalink( $output_html, $item, $bool = false ) {
// Only email notifications
if( is_wc_endpoint_url() )
return $output_html;
$product = $item->get_product();
return '<a href="'.esc_url( $product->get_permalink() ).'">' . $output_html . '</a>';
}
function cw_edit_order_item_name( $name ) {
$name = '<br><br/>' .$name;
return $name . '<br><br /><center><strong>SKU:</strong></center>';
}
add_filter( 'woocommerce_order_item_name', 'cw_edit_order_item_name' );
I have this problem with the WooCommerce order item table within the order emails that the product thumbnail needs to be moved to the left of the product title, and the title should fit neatly in to the right.
We would have to change the width of the order item tables columns so this fits in nicely. This also needs to be mobile responsive.
Here is a screenshot of exactly what I am trying to achieve:
And this is what I have:
Things to consider,
- SKU Must be displayed
- Link to the product must be included
- The Columns need to be wider.
I will really appreciate any help here.