Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Filter New Order email headers for WooCommerce
add_filter('woocommerce_email_header', 'spigot_reply_to_mail_filter', 11, 3);
function spigot_reply_to_mail_filter($headers = '', $ordertype = 'new_order', $order = '') {
if(!is_object($order) || empty($order) || $ordertype !== 'new_order') { return $headers; }
$name = $order->get_billing_first_name().' '.$order->get_billing_last_name();
$email = $order->get_billing_email();
if(is_array($headers)) {
$headers['Reply-To'] = "{$name} <{$email}>";
} else {
$headers .= "Reply-To: {$name} <{$email}>\r\n";
}
return $headers;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.