Last active
January 30, 2021 21:42
-
-
Save ddemuth/3279872edbc8ad6be13418ea8a0aa79b to your computer and use it in GitHub Desktop.
Customize the email recipient
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//WooCommerce Email Customizations | |
add_filter( 'woocommerce_email_recipient_customer_note', array( $this, 'fka_parent_email_recipient_filter_function' ), 10, 2); | |
add_filter( 'woocommerce_email_recipient_customer_completed_order', array( $this, 'fka_parent_email_recipient_filter_function' ), 10, 2); | |
add_filter( 'woocommerce_email_recipient_customer_invoice', array( $this, 'fka_parent_email_recipient_filter_function' ), 10, 2); | |
add_filter( 'woocommerce_email_recipient_customer_processing_order', array( $this, 'fka_parent_email_recipient_filter_function' ), 10, 2); | |
/** | |
* $recipient could be comma separated to send to additional people | |
* EX. $recipient .= ', $additonal_recipient'; | |
*/ | |
function fka_parent_email_recipient_filter_function($recipient, $order) { | |
$parent_email_recipient = get_post_meta( $order->id, 'Parent Email', true ); | |
$recipient = $parent_email_recipient; | |
return $recipient; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
WordPress Version: 5.2.2
WooCommerce version: 3.7.0
add_filter( 'woocommerce_email_recipient_customer_note', 'termatech_email_recipient_filter_function', 10, 2);
add_filter( 'woocommerce_email_recipient_customer_completed_order', 'termatech_email_recipient_filter_function', 10, 2);
add_filter( 'woocommerce_email_recipient_customer_invoice', 'termatech_email_recipient_filter_function', 10, 2);
add_filter( 'woocommerce_email_recipient_customer_processing_order', 'termatech_email_recipient_filter_function', 10, 2);
function termatech_email_recipient_filter_function($recipient, $order) {
$recipient .= ','. get_post_meta($order->get_id(), '_billing_nearest_dealer_email', true);
return $recipient;
}