updateCartDiscountCodes method
update cart discount codes
Implementation
Future<Cart> updateCartDiscountCodes({
required String cartId,
required List<String> discountCodes,
}) async {
final MutationOptions updateDiscountCodes = MutationOptions(
document: gql(updateCartDiscountCodesMutation),
variables: {
'cartId': cartId,
'discountCodes': discountCodes,
'country': ShopifyLocalization.countryCode,
},
);
QueryResult result = await _graphQLClient!.mutate(updateDiscountCodes);
checkForError(result,
key: 'cartDiscountCodesUpdate', errorKey: 'userErrors');
return Cart.fromJson(
((result.data!['cartDiscountCodesUpdate'] ?? const {})['cart'] ??
const {}));
}