Cannot override sender address
-
Hello, I’ve used your plugin and Woocommerce, both of them functions well, but when I use the function as follows, from woocommerce doc #8 (“Can I adjust my “New Order” emails to show my customer’s name and email address instead of my own?” https://docs.woocommerce.com/document/email-faq/), it doesn’t work (I checked “don’t override “from” address and name). I deactivated your plugin and test this function, it works well (sender info changes that of customer’s). Also I tested with POST SMTP plugin, and it works well without issue. Can you solve this?
I’d like to continue to use your plugin along with this script. Thank you.function custom_use_customer_from_address ( $from_email, $obj ) { if ( is_a( $obj, 'WC_Email_New_Order' ) ) { $address_details = $obj->object->get_address( 'billing' ); if ( isset( $address_details['email'] ) && '' != $address_details['email'] ) { $from_email = $address_details['email']; } } return $from_email; } add_filter( 'woocommerce_email_from_address', 'custom_use_customer_from_address', null, 2 ); function custom_use_customer_from_name ( $from_name, $obj ) { if ( is_a( $obj, 'WC_Email_New_Order' ) ) { $address_details = $obj->object->get_address( 'billing' ); if ( isset( $address_details['first_name'] ) && '' != $address_details['first_name'] ) { $from_name = $address_details['first_name']; } if ( isset( $address_details['last_name'] ) && '' != $address_details['last_name'] ) { $from_name .= ' ' . $address_details['last_name']; } } return $from_name; } add_filter( 'woocommerce_email_from_name', 'custom_use_customer_from_name', null, 2 );
The topic ‘Cannot override sender address’ is closed to new replies.