I’m using woocommerce and dokan plugin in wordpress.
After I try to order product in multi vendor, I get the sub order number in thank you page.
I try to get sub order number by running this code below but not work.
//example order id
$order = wc_get_order(1234);
$order_id = $order->get_id();
$sub_orders = get_children(
array(
'post_parent' => $order_id,
'post_type' => 'shop_order',
'post_status' => array(
'wc-pending',
'wc-completed',
'wc-processing',
'wc-on-hold'
)
)
);
when i try var_dump($sub_order)
i got 0 array result.
is any way to get sub order?
2
Answers
Try this:
Note that if the parent order contains products only from one vendor your
$sub_orders
variable will be empty.I found this function in plugin:
I think you can use her for getting sub orders, for example:
Hope help you