I am working in woocommerce add order from API. I already added order by using wc_create_order()
function. In that, I have added shipping address, billing address, and product details as well. But the problem is I want to add shpping cost as per shipping zone.
Here is screenshot :
However I found class with function called : WC_Shipping_Zones::get_zones().
But it return unarranged (unmanaged) array. I have state code and then I want to get shipping cost from state code.
However, I have found zone_id.
I have already tried to use WC_Shipping_Zones::get_zone_by('zone_id',$zone_id),WC_Shipping_Zones::get_zone($zone_id);
But none of functions return cost anyhow.
Here is the code to get the zone cost. I hope it helps.
global $post, $woocommerce;