You can foun many code snippets to get list of all available shipping methods based on order or cart object.
But if you need to get this list in admin area for some purpose in your plugin, etc. you can use this code snippet:

$delivery_zones = WC_Shipping_Zones::get_zones();

foreach ((array) $delivery_zones as $key => $the_zone) {

    echo "<b>" . $the_zone['zone_name'] . "</b><br>";
    foreach ($the_zone['shipping_methods'] as $value) {
        //print_r($value);
        echo $value->title . " ( " . $value->method_title . " - " . $value->cost . ")" . $value->id . ":" . $value->instance_id;
    }
    echo "<br>";
}

The key here is getting methods with already initialized instance_id.

This code also can be found on Stackoverflow.

Leave a Reply

Your email address will not be published.