Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save gsdefender/e671d9fcffeda3b0fbef87e25890a31d to your computer and use it in GitHub Desktop.
Save gsdefender/e671d9fcffeda3b0fbef87e25890a31d to your computer and use it in GitHub Desktop.
Customize the email recipient
//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