I'm using Woocommerce and the Product Addons plugin to add extra fields to a product. One of those fields is an email address to let people send the confirmation of the order to a DIFFERENT address than the billing address shown on the checkout page. Emails should be sent to both addresses.
Any thoughts on maybe how to modify the functions.php file to do this?
You can add below code in your function.php
and if you want to send email in BCC then please try below code:
In the
woocommerce_email_recipient_{$this->id}
filter hook, you can use the$order
argument to get your 2nd email.But first Lets add globally an email field with the Product Add-ons plugin…
As you can notice the label of this field is "Email"…
Now if I look in the database in
wp_woocommerce_order_itemmeta
for this order I can see for themeta_key "Email"
themeta_value "loic@TheAztec.com"
:Now I can set the correct
meta_key
in the code below to get my email.Here is the code that will add this additional email recipient for processing and completed customer order email notifications:
Code goes in function.php file of your active child theme (or theme) or also in any plugin file.
Tested and works.