How to get vendor details from order inside woocommerce hooks - Dokan

How can I get vendor info/details from an order inside woocommerce hooks. So far I've been able to get standard woocommerce fields from the order like so:

add_action('woocommerce_order_status_completed', 'wc_send_complete_notif');
function wc_send_complete_notif( $order_id ) {
    $order = wc_get_order( $order_id );
    $phone = $order->billing_phone;
}

Now what I want to do is get Vendor Name and Vendor Phone Number from that order and do some post processing.


Dokan has a helper function to get the seller id by order. Here's how to get vendor user ID from an order:

$seller = dokan_get_seller_id_by_order( $order_id );

Now, in case you are working with sub-orders:

        $sellers = dokan_get_seller_id_by_order( $order_id );

        // check has sub order 
        if ( $order->get_meta('has_sub_order') ) {
            foreach ($sellers as $seller) {
                $seller_info      = get_userdata( $seller );
                $seller_email     = $seller_info->user_email;
            }
        } else {
            $seller_info      = get_userdata( $sellers );
            $seller_email     = $seller_info->user_email;
        }

It is tested and working with the latest Dokan version 3.x