Reputation: 19
I would like to change email sender, depending on order total value.
Example:
I cant figure out how to get $order dealing with email sender.
Thank you
Upvotes: 0
Views: 123
Reputation: 36
You can use 'woocommerce_email_recipient_new_order' filter hook(Check here) to change sender email Please check below code you can get basic idea,
function wc_change_admin_new_order_email_recipient( $recipient, $order ) {
global $woocommerce;
if ( $order->get_total() > 100 ) { // Set your condition here and dump to know more about $order
$recipient = "[email protected]";
} else {
$recipient = "[email protected]";
}
return $recipient;
}
add_filter('woocommerce_email_recipient_new_order', 'wc_change_admin_new_order_email_recipient', 1, 2);
Upvotes: 1