checkoutGiftCardAppend method

Future<void> checkoutGiftCardAppend(
  1. String checkoutId,
  2. List<String> giftCardCodes, {
  3. bool deleteThisPartOfCache = false,
})

Appends the giftCardCodes to the Checkout that checkoutId belongs to.

Implementation

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