checkoutDiscountCodeApply method
Applies discountCode
to the Checkout that checkoutId
belongs to.
Implementation
Future<Checkout> checkoutDiscountCodeApply(
String checkoutId,
String discountCode,
) async {
final MutationOptions _options = MutationOptions(
document: gql(checkoutDiscountCodeApplyV2Mutation),
variables: {'checkoutId': checkoutId, 'discountCode': discountCode});
final QueryResult result = await _graphQLClient!.mutate(_options);
checkForError(
result,
key: 'checkoutDiscountCodeApplyV2',
errorKey: 'checkoutUserErrors',
);
return Checkout.fromJson(((result.data?['checkoutDiscountCodeApplyV2'] ??
const {})['checkout'] ??
const {}));
}