Banner Logo

Be a part of the family: Connect, Receive Support,
Contribute, and Reap Abundant Rewards

View Categories

Vendor new order mail for some order status only

Add the below code in the functions.php file of your current active theme to let the vendor receive new order mail for some order status only.



function restrict_vendor_new_order_mail($recipient, $order) {
   $order_status = $order == NULL ? "cancelled": $order->get_status();
   //In new order,vendor will receive only 'processing' mail no other mail will send to vendor.
   if ($order_status == 'failed' || $order_status == 'on-hold' || $order_status == 'cancelled' || $order_status == 'pending' && !$order_status == 'processing') {
       return;
   } else {
       return $recipient;
   }
}
add_filter('woocommerce_email_recipient_vendor_new_order', 'restrict_vendor_new_order_mail', 1, 2);

Leave a Reply