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.
2
Answers
Dokan has a helper function to get the seller id by order. Here’s how to get vendor user ID from an order:
Now, in case you are working with sub-orders:
It is tested and working with the latest Dokan version 3.x