checkoutDiscountCodeApply method
Applies discountCode
to the Checkout that checkoutId
belongs to.
Implementation
Future<void> checkoutDiscountCodeApply(String checkoutId, String discountCode,
{bool deleteThisPartOfCache = false}) async {
final MutationOptions _options = MutationOptions(
document: gql(checkoutDiscountCodeApplyMutation),
variables: {'checkoutId': checkoutId, 'discountCode': discountCode});
final QueryResult result = await _graphQLClient!.mutate(_options);
checkForError(
result,
key: 'checkoutDiscountCodeApplyV2',
errorKey: 'checkoutUserErrors',
);
if (deleteThisPartOfCache) {
_graphQLClient!.cache.writeQuery(_options.asRequest, data: {});
}
}