updateLineItemsInCart method
Future<Cart>
updateLineItemsInCart({
- required String cartId,
- required List<
CartLineUpdateInput> cartLineInputs,
update line items in cart
Implementation
Future<Cart> updateLineItemsInCart({
required String cartId,
required List<CartLineUpdateInput> cartLineInputs,
}) async {
final lineInputs = cartLineInputs.map((e) => e.toJson()).toList();
final MutationOptions updateLineItem = MutationOptions(
document: gql(updateLineItemInCartMutation),
variables: {
'cartId': cartId,
'lines': lineInputs,
'country': ShopifyLocalization.countryCode,
},
);
QueryResult result = await _graphQLClient!.mutate(updateLineItem);
checkForError(result, key: 'cartLinesUpdate', errorKey: 'userErrors');
return Cart.fromJson(
((result.data!['cartLinesUpdate'] ?? const {})['cart'] ?? const {}));
}