checkoutLineItemsReplace method

Future<void> checkoutLineItemsReplace(
  1. String checkoutId,
  2. List<String> variantIdList
)

Replaces the LineItems in the Checkout associated to the checkoutId.

checkoutLineItems is a List of Variant Ids

Implementation

Future<void> checkoutLineItemsReplace(
  String checkoutId,
  List<String> variantIdList,
) async {
  var checkoutLineItems = transformVariantIdListIntoListOfMaps(variantIdList);
  final MutationOptions _options = MutationOptions(
    document: gql(replaceCheckoutItemsMutation),
    variables: {
      'checkoutId': checkoutId,
      'checkoutLineItems': checkoutLineItems,
    },
  );
  final QueryResult result = await _graphQLClient!.mutate(_options);
  checkForError(
    result,
    key: 'checkoutLineItemsReplace',
    errorKey: 'userErrors',
  );
}