Reputation: 1399
I added a custom field to all WooCommerce order mails but i dont want it to be shown to the emails to the customer bust just to the admin (new order mail).
/*----------------------------------------------
Add Delivery Date Field to the order emails
-------------------------------------------------*/
add_filter('woocommerce_email_order_meta_fields', 'my_woocommerce_email_order_meta_fields', 0, 3 );
function my_woocommerce_email_order_meta_fields( $fields, $sent_to_admin, $order ) {
$fields[ 'birthdate' ] = array(
'label' => 'Geburtstag',
'value' => $order->get_meta( '_billing_birthdate' )
);
return $fields;
}
Upvotes: 1
Views: 668
Reputation: 11841
$sent_to_admin = 1
, email being sent to admin, $sent_to_admin = 0
, email NOT being sent to admin.
function my_woocommerce_email_order_meta_fields($fields, $sent_to_admin, $order) {
if ($sent_to_admin) {
$fields['birthdate'] = array(
'label' => 'Geburtstag',
'value' => $order->get_meta('_billing_birthdate')
);
}
return $fields;
}
add_filter('woocommerce_email_order_meta_fields', 'my_woocommerce_email_order_meta_fields', 0, 3);
Upvotes: 1