getAllShippingZoneMethods method

Future<List<WooShippingZoneMethod>> getAllShippingZoneMethods({
  1. required int shippingZoneId,
})

Returns a list of all WooShippingZoneMethod associated with a shipping zone.

Related endpoint: https://woocommerce.github.io/woocommerce-rest-api-docs/#shipping-zone-locations.

Implementation

Future<List<WooShippingZoneMethod>> getAllShippingZoneMethods(
    {required int shippingZoneId}) async {
  List<WooShippingZoneMethod> shippingZoneMethods = [];
  _setApiResourceUrl(
      path: 'shipping/zones/' + shippingZoneId.toString() + '/methods');
  final response = await get(queryUri.toString());
  for (var l in response) {
    var sMethod = WooShippingZoneMethod.fromJson(l);
    _printToLog(
        'shipping zone locations gotten here : ' + sMethod.toString());
    shippingZoneMethods.add(sMethod);
  }
  return shippingZoneMethods;
}