Filters the HTML for the order items to be shown in emails.
Available Parameters
array $args - array of allowed arguments
//$args array elements are as below
array(
'order' => WC_Order Order object
'items' => Order items - $order->get_items()
'show_download_links' => (bool) Download link for downloadable products
'show_sku' => (bool) Product SKU
'show_purchase_note' => (bool) Purchase note
'show_image' => (bool) Product image
'image_size' => (array) Product image size
'plain_text' => (bool) HTML or plain text email
'sent_to_admin' => (bool) Is it admin email or customer email
)
Defaults
$defaults = array(
'show_sku' => false,
'show_image' => false,
'image_size' => array( 32, 32 ),
'plain_text' => false,
'sent_to_admin' => false,
);
Source code: woocommerce_email_order_items_args
Code Example 1
Add product images to WooCommerce order email
function careless_add_images_to_wc_emails( $args ) {
$args['show_image'] = true;
$args['image_size'] = array( 100, 50 );
return $args;
}
add_filter( 'woocommerce_email_order_items_args', 'careless_add_images_to_wc_emails' );
Code Example 2
Add product SKU to WooCommerce order email
function careless_add_sku_to_wc_emails( $args ) {
$args['show_sku'] = true;
return $args;
}
add_filter( 'woocommerce_email_order_items_args', 'careless_add_sku_to_wc_emails' );
Code Example 3
Add purchase note to WooCommerce order email
function careless_add_notes_to_wc_emails( $args ) {
$args['show_purchase_note'] = true;
return $args;
}
add_filter( 'woocommerce_email_order_items_args', 'careless_add_notes_to_wc_emails' );
All example code goes in the functions.php
file of your active theme.