deleteCustomer method

Future<void> deleteCustomer({
  1. required String userId,
})

Delete current user and clears it from the disk cache.

Implementation

Future<void> deleteCustomer({required String userId}) async {
  if (_graphQLClientAdmin == null) {
    throw const ShopifyException(
      'customerDelete',
      'userErrors',
      errors: [
        'Admin access token is not provided. Pass adminAccessToken to '
            'ShopifyConfig.setConfig to use admin API calls.'
      ],
    );
  }
  final MutationOptions _options = MutationOptions(
    document: gql(customerDeleteMutation),
    variables: {'id': userId},
  );
  final QueryResult result = await _graphQLClientAdmin!.mutate(_options);
  checkForError(
    result,
    key: 'customerDelete',
    errorKey: 'userErrors',
  );
  await _setShopifyUser(null, null);
}