Reputation: 306
In Woocommerce I am using "Show Woocommerce custom checkout field value in admin order making them editable" answer code that display a custom field value in admin order pages and works nicely.
My question: Is it possible to display that Custom field value in email notification?
Upvotes: 0
Views: 138
Reputation: 254448
You can use the following to display your custom field "Invoice Number" on email notifications:
add_action('woocommerce_email_order_details', 'woocommerce_email_order_invoice_number', 4, 4 );
function woocommerce_email_order_invoice_number( $order, $sent_to_admin, $plain_text, $email ) {
if( $value = get_post_meta( $order->get_id(), '_billing_options', true ) )
echo '<p><strong>'.__('Invoice Number').':</strong> '.$value.'</p>';
}
Code goes in function.php file of your active child theme (or active theme). tested and works.
Upvotes: 1