Add custom field to “customer details” block in order email
-
We have added a “gift card comments” custom field on WooCommerce checkout, which we then show on the order details page by adding it to /order/order-details-customer.php This works fine, it looks like this:
Customer details
Delivery Instructions: Some instructions
Gift Card Comments: Some comments
Email: [email protected]
Telephone: 012345We have trouble getting the same output in the order email. If we add this to functions.php:
function custom_gift_card__order_meta_keys( $keys ) { $keys[] = 'Gift Card Comments'; return $keys; } add_filter('woocommerce_email_order_meta_keys', 'custom_gift_card__order_meta_keys');
it gets added to above the customer details block. We have tried hooking into:
woocommerce_email_customer_details
but don’t get any output. Ideally we would like to:
1. Get gift card comments in second place, just as on checkout – but would be happy to get it anywhere in the customer details block.
2. Rename “Note” label in email to “Delivery Instructions”.
- The topic ‘Add custom field to “customer details” block in order email’ is closed to new replies.