Change WooCommerce New Order reply-to address to customer

PHOTO EMBED

Thu Aug 24 2023 16:31:20 GMT+0000 (Coordinated Universal Time)

Saved by @mastaklance

/**
 * Change Woocommerce New Order reply-to address to customer
 */
add_filter('woocommerce_email_headers', 'change_new_order_email_reply_to', 10, 3);

function change_new_order_email_reply_to($headers, $email_id, $order) {
    if ($email_id === 'new_order') {
        $customer_name = $order->get_billing_first_name() . ' ' . $order->get_billing_last_name();
        $customer_email = $order->get_billing_email();
        
        $headers .= "Reply-To: $customer_name <$customer_email>\r\n";
    }
    
    return $headers;
}
content_copyCOPY