updateNoteInCart method

Future<Cart> updateNoteInCart({
  1. required String cartId,
  2. required String note,
  3. bool reverse = false,
})

update note in cart

If the reverse is set to true, the line items in the cart will be in reverse order.

Implementation

Future<Cart> updateNoteInCart({
  required String cartId,
  required String note,
  bool reverse = false,
}) async {
  final MutationOptions updateNote = MutationOptions(
    document: gql(updateNoteInCartMutation),
    variables: {
      'cartId': cartId,
      'note': note,
      'country': ShopifyLocalization.countryCode,
      'reverse': reverse,
    },
  );
  QueryResult result = await _graphQLClient!.mutate(updateNote);
  checkForError(result, key: 'cartNoteUpdate', errorKey: 'userErrors');

  return Cart.fromJson(
      ((result.data!['cartNoteUpdate'] ?? const {})['cart'] ?? const {}));
}