2

I have installed Dokan multivendor plugin along with my woocommerce and it sends multiple email for customer for a single order if the order contains diffrent seller's product.

The order mail as follows,

  1. Mail with all product purchased.
  2. Product with one seller from the order.

How can I prevent sending multiple mails, I just need to send summary mail to customer, that is the mail with all product with single mail.

Any help?

Navas Fazil
  • 43
  • 1
  • 5

2 Answers2

2

When a customer will purchase a product from multiple vendors that time the customer will get an email for each sub-order and the parent order.

This customer notification is coming from the WooCommerce/includes/class-we-emails.php file. You can check this function- public function init(). They have included every file notification to send the email. The hook will run everytime when the system will get an order. Now, if you want that customer will not get an email for each sub-order then you have to unset those key `emails['WC_Email_New_Order']by using the filter.

Also, you can open dokan-lite/includes/wc-crud-functions.php. In this file you can find the action- do_action( 'woocommerce_new_order', $order_id ); You can find the sub-order by order id and you can unset the order notification key by when the order is sub-order.

Nazmul Hassan
  • 321
  • 1
  • 7
1

this may come in handy. use @LoicTheAztec solution from Remove woocommerce complete or processing email based on order meta. But in this case replace the second if condition with the code below

if (!get_post_meta( $order->get_id(), 'has_sub_order', true ) && !empty(wp_get_post_parent_id($order->get_id())) ){
    return '';
}
Vybz
  • 11
  • 1