checkoutLineItemsReplace method
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, {
bool deleteThisPartOfCache = false,
}) 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',
);
if (deleteThisPartOfCache) {
_graphQLClient!.cache.writeQuery(_options.asRequest, data: {});
}
}