Skip to content
Advertisement

Display custom order meta data value in email notifications WooCommerce

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.

JavaScript

Advertisement

Answer

You have some minor mistakes, via the if condition "$email->id == ..." you can target the mails

How to target other WooCommerce order emails

  • ‘customer_completed_order’
  • ‘customer_processing_order’
  • ‘customer_on_hold_order’
  • ‘customer_refunded_order’
  • ‘customer_reset_password’
  • ‘customer_invoice’
  • ‘customer_new_account’
  • ‘customer_note’
  • ‘cancelled_order’
  • ‘failed_order’
  • ‘new_order’

JavaScript
User contributions licensed under: CC BY-SA
1 People found this is helpful
Advertisement