getProductVariationsByProductId method

Future<List<WooProductVariation>> getProductVariationsByProductId({
  1. required int productId,
})

Returns a ListWooProductVariation, with the specified productId only.

Implementation

Future<List<WooProductVariation>> getProductVariationsByProductId(
    {required int productId}) async {
  List<WooProductVariation> productVariations = [];
  _setApiResourceUrl(
      path: 'products/' + productId.toString() + '/variations/');
  final response = await get(queryUri.toString());

  for (var v in response) {
    var prodv = WooProductVariation.fromJson(v);
    _printToLog('prod gotten here : ' + prodv.toString());
    productVariations.add(prodv);
  }
  return productVariations;
}