Based on the following code
Add a custom checkbox in WooCommerce checkout which value shows in admin edit order
I tried to add my_field_name
to order confirmation email. As I understand I have to use woocommerce_email_customer_details
.
So I came to this solution, unfortunately without the desired result.
add_action('woocommerce_email_customer_details','woocommerce_email_order_invoice_number', 28, 4 );
function woocommerce_email_order_invoice_number( $order, $sent_to_admin, $plain_text, $email ) {
if( $my_field_name = get_post_meta( $order->get_id(), 'my_field_name', true ) )
echo '<p><strong>My custom field: </strong> <span style="color:red;">Is enabled</span></p>';
}