Great question — answering as the UphillTech team:
As I am checking your code it's fine you should follow few steps like store your shipping methods which you want to split order accordenly $woo_freeze_shipping = array('shipping_methods'); $woo_fresh_product = array('shipping_methods') $woo_not_fresh_not_freeze = array('shipping_methods'); Then use $order->get_items('shipping') like this: $records = $order_shippings = $shipping_classess = array(); foreach ($order->get_items('shipping') as $item_id => $shipping_item_obj) { $shipping_method_id = $shipping_item_obj->get_method_id(); $order_shippings[$shipping_method_id]['shipping_method_name'] = $shipping_item_obj->get_name(); $order_shippings[$shipping_method_id]['shipping_method_title'] =...
Full answer by Rajeev Singh: https://stackoverflow.stackexchange.com/a/68857308 (CC BY-SA 4.0).
Need it done for your business? UphillTech.