Dokan Lite main file dokan.php has a method called init_classes(), where instantiate requires classes and binds to the container. Inside init_classes() method, Dokan binds WeDevs\Dokan\Order\Manager(); class in container as order. With the help of this container, anyone can call WeDevs\Dokan\Order\Manager‘s any method. Like-
dokan()->order->create_sub_order( $parent_order, $seller_id, $seller_products );
You also can use these methods-
Get a vendor’s all orders with some conditions
$args = [
'seller_id' => dokan_get_current_user_id(),
'customer_id' => null,
'status' => 'all',
'paged' => 1,
'limit' => 10,
'date' => null,
];
dokan()->order->all( $args ); // return $orders; all order from a specific vendor.
This Order class also uses its funtions.php
Get a vendor’s all orders
Alternative funtion for dokan()->order->all( $args );
dokan_get_seller_orders( $seller_id, $status = 'all', $order_date = null, $limit = 10, $offset = 0, $customer_id = null );
// // return $orders; all order from a specific vendor.
Get a seller ID based on WooCommerce order. If Order has suborder, this method will return 0
$order_id = 10;
$seller_id = dokan_get_seller_id_by_order( $order_id );
// return 2
Get all sellers by an order
dokan_get_sellers_by( WC_Order $order );
// return all sellers.
Get a vendors total order number
$args = [
'seller_id' => $seller_id,
'status' => $order_status,
'customer_id' => $customer_id,
'date' => $order_date,
]
dokan_get_seller_orders_number( $args );
// return 10. Total number of orders of a seller.