Title: Custom email field code not working.
Last modified: December 10, 2019

---

# Custom email field code not working.

 *  Resolved [fruostehaps](https://wordpress.org/support/users/fruostehaps/)
 * (@fruostehaps)
 * [6 years, 5 months ago](https://wordpress.org/support/topic/custom-email-field-code-not-working/)
 * Hi I found this code in a previous tread, as I also need to set a custom email
   field to send a new order email notification to, but the code is not working.
   It tells me theres an error in the 4th last line: $emails .= ‘,’.$aditional_email;
   
   Can anyone tell me what is wrong?
 * add_filter(‘woocommerce_email_recipient_new_order’, ‘additional_email_checkout’,
   10, 2);
    function additional_email_checkout($emails, $object){ $aditional_email
   = get_post_meta($object->id, ‘field_name‘, true); if($aditional_email){ $emails.
   = ‘,’.$aditional_email; } return $emails; }

Viewing 4 replies - 1 through 4 (of 4 total)

 *  Plugin Author [ThemeHigh](https://wordpress.org/support/users/themehigh/)
 * (@themehigh)
 * [6 years, 5 months ago](https://wordpress.org/support/topic/custom-email-field-code-not-working/#post-12226304)
 * We believe that it might be an issue with the format of the single quotes. Could
   you please remove the single quotes and add them again to the code.
 * We have checked and confirmed that the code is working fine.
 * Or please try to copy the below code:
 *     ```
       add_filter('woocommerce_email_recipient_new_order', 'additional_email_checkout', 10, 2);
       function additional_email_checkout($emails, $object){
       $aditional_email = get_post_meta($object->id, 'your_field_name', true);
       if($aditional_email){
       $emails .= ','.$aditional_email;
       }
       return $emails;
       }
       ```
   
 * Replace _**your\_field\_nam**_e with your additional email field name.
 * Hope this will help.
 * Thank you!
 *  Thread Starter [fruostehaps](https://wordpress.org/support/users/fruostehaps/)
 * (@fruostehaps)
 * [6 years, 5 months ago](https://wordpress.org/support/topic/custom-email-field-code-not-working/#post-12226508)
 * Hi.
 * Now the code is working, thank you very much. I’ve also replaced the email field
   name to rep_email, but I do not receive a new order email to the mail inserted
   in the custom field in checkout. Is there anything else I need to do?
 *  Plugin Author [ThemeHigh](https://wordpress.org/support/users/themehigh/)
 * (@themehigh)
 * [6 years, 5 months ago](https://wordpress.org/support/topic/custom-email-field-code-not-working/#post-12233748)
 * We have checked in our testing environment and could see that the email is getting
   received to the secondary email address.
 * Could you please raise a ticket through our website? We hope our technical team
   will be able to help you.
 * Thank you!
 *  Plugin Author [ThemeHigh](https://wordpress.org/support/users/themehigh/)
 * (@themehigh)
 * [6 years, 5 months ago](https://wordpress.org/support/topic/custom-email-field-code-not-working/#post-12254167)
 * We hope your issue is resolved now.
 * We are going to mark this thread as resolved.
 * Thank you!

Viewing 4 replies - 1 through 4 (of 4 total)

The topic ‘Custom email field code not working.’ is closed to new replies.

 * ![](https://ps.w.org/woo-checkout-field-editor-pro/assets/icon-256x256.gif?rev
   =3479964)
 * [Checkout Field Editor (Checkout Manager) for WooCommerce](https://wordpress.org/plugins/woo-checkout-field-editor-pro/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/woo-checkout-field-editor-pro/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/woo-checkout-field-editor-pro/)
 * [Active Topics](https://wordpress.org/support/plugin/woo-checkout-field-editor-pro/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/woo-checkout-field-editor-pro/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/woo-checkout-field-editor-pro/reviews/)

 * 4 replies
 * 2 participants
 * Last reply from: [ThemeHigh](https://wordpress.org/support/users/themehigh/)
 * Last activity: [6 years, 5 months ago](https://wordpress.org/support/topic/custom-email-field-code-not-working/#post-12254167)
 * Status: resolved