customerAddressDelete method

Future<void> customerAddressDelete({
  1. String? customerAccessToken,
  2. String? addressId,
  3. bool deleteThisPartOfCache = false,
})

Deletes the address associated with the addressId from the customer to which customerAccessToken belongs to.

A Customer may have more than 1 address, so the addresses have Id's.

Implementation

Future<void> customerAddressDelete(
    {String? customerAccessToken,
    String? addressId,
    bool deleteThisPartOfCache = false}) async {
  final MutationOptions _options = MutationOptions(
      document: gql(customerAddressDeleteMutation),
      variables: {
        'customerAccessToken': customerAccessToken,
        'id': addressId
      });
  final QueryResult result = await _graphQLClient!.mutate(_options);
  checkForError(
    result,
    key: 'customerAddressDelete',
    errorKey: 'customerUserErrors',
  );
  if (deleteThisPartOfCache) {
    _graphQLClient!.cache.writeQuery(_options.asRequest, data: {});
  }
}