To add information for message of new order only for admin. This code snippet is for funtions.php file, sets global variable about info of mail message, and adds a custom info to table cell of new order, if the mail message is for admin of WooCommerce .
function email_order_id_as_a_global($order,
$sent_to_admin, $plain_text, $email)
{
$GLOBALS['email_data'] = array(‘sent_to_admin' => $sent_to_admin,
'email_id' => $email->id);
}
add_action(‘woocommerce_email_before_order_table',
'email_order_id_as_a_global', 1, 4);
function your_order_item_meta_start( $item_id,
$item, $order, $plain_text ) {
$refNameGlobalsVar = $GLOBALS['email_data'];
if (($refNameGlobalsVar[‘sent_to_admin']) &&
($refNameGlobalsVar['email_id'] == ‘new_order'))
{
echo "Custom field name: " . ' Custom information to table cell';
}
}
add_action( ‘woocommerce_order_item_meta_end', 'your_order_item_meta_start',
20, 4 );