checkoutDiscountCodeRemove method

Future<void> checkoutDiscountCodeRemove(
  1. String checkoutId, {
  2. bool deleteThisPartOfCache = false,
})

Removes the applied discount from the Checkout that checkoutId belongs to.

Implementation

Future<void> checkoutDiscountCodeRemove(String checkoutId,
    {bool deleteThisPartOfCache = false}) async {
  final MutationOptions _options = MutationOptions(
      document: gql(checkoutDiscountCodeRemoveMutation),
      variables: {'checkoutId': checkoutId});
  QueryResult result = await _graphQLClient!.mutate(_options);
  checkForError(
    result,
    key: 'checkoutDiscountCodeRemove',
    errorKey: 'checkoutUserErrors',
  );
  if (deleteThisPartOfCache) {
    _graphQLClient!.cache.writeQuery(_options.asRequest, data: {});
  }
}