@am.injabari242, let me assit you with the flow :
When an order is placed, we also create the sub-order for the vendors. This way, the vendor manages their own order.
Now if you want, you can stop the main order email. For this use this code :
add_filter( 'woocommerce_email_recipient_customer_refunded_order', 'disable_email_for_sub_order', 10,3 );
add_filter( 'woocommerce_email_recipient_customer_completed_order', 'disable_email_for_sub_order', 10,3 );
add_filter( 'woocommerce_email_recipient_customer_on_hold_order', 'disable_email_for_sub_order', 10,3 );
add_filter( 'woocommerce_email_recipient_customer_processing_order', 'disable_email_for_sub_order', 10,3 );
function disable_email_for_sub_order( $recipient, $order, $object ){
if( wp_get_post_parent_id( $order->get_id() ) ){
return $recipient;
} else {
return;
}
}
Copy