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.