deleteAllMyCartItems method

Future deleteAllMyCartItems()

Implementation

Future deleteAllMyCartItems() async {
  await getAuthTokenFromDb();
  _urlHeader['Authorization'] = 'Bearer ' + _authToken!;

  final http.Response response = await http.delete(
    Uri.parse(this.baseUrl + URL_STORE_API_PATH + 'cart/items/'),
    headers: _urlHeader,
  );
  _printToLog('response of delete cart  : ' + response.body.toString());

  if (response.statusCode >= 200 && response.statusCode < 300) {
    return response.body;
  } else {
    WooCommerceError err =
        WooCommerceError.fromJson(json.decode(response.body));
    throw err;
  }
}