Open samjco opened 5 years ago
Hello,
You can get the suborders from a main order like this:
$suborders = get_post_meta( $order_id, Alg_MOWC_Order_Metas::SUB_ORDERS );
And to get the parent order id from a suborder you can do it like this:
$main_order_id = get_post_meta( $suborder_id, Alg_MOWC_Order_Metas::PARENT_ORDER, true );
SO does this look right:
$order = new WC_Order( $order_id );
foreach ($order->get_items() as $item_key => $item_values):
$formatted_meta_data = $item_values->get_formatted_meta_data('Alg_MOWC_Order_Metas::SUB_ORDERS', true);
// Display the raw outputs (for testing)
echo '<pre>';
print_r($formatted_meta_data);
echo '</pre>';
endforeach;
Is there a function where I can get the suborder numbers from and WC order number?