0

I am trying to change the "From email" address in woocommerce to be the actual customer email address as opposed to the admin email address.

This is specifically for the new_order email that gets sent to the site admin.

I found this bit of code that succesfully changed "from name" to the customer name.

add_filter( 'woocommerce_email_from_name', 'filter_wc_email_from_name', 10, 2 );
function filter_wc_email_from_name( $from_name, $email ){
    if( $email->id == 'new_order' && is_a($email->object, 'WC_Order') ) {
        $order     = $email->object;
        $from_name = $order->get_formatted_billing_full_name();
    }
    return $from_name;
}

This code works perfectly, but now I really want to change the "from email" address to be that of the customer who has placed the order.

GrantRez
  • 1
  • 1
  • What did you Google? `woocommerce_email_from_address`? – Djave Jan 30 '22 at 19:33
  • _"I am trying to change the "From email" address in woocommerce to be the actual customer email address"_ - that is a _bad_ idea, it will increase the likelihood of these mails getting eaten by the spam filter. See https://stackoverflow.com/a/24644450/1427878, section titled "Don't use a faux From: sender" – CBroe Jan 31 '22 at 08:29

0 Answers0