removeLineItemsFromCart method
remove line item from cart
If the reverse
is set to true, the line items in the cart will be in reverse order.
Implementation
Future<Cart> removeLineItemsFromCart({
required String cartId,
required List<String> lineIds,
bool reverse = false,
}) async {
final MutationOptions removeLineItem = MutationOptions(
document: gql(removeLineItemFromCartMutation),
variables: {
'cartId': cartId,
'lineIds': lineIds,
'country': ShopifyLocalization.countryCode,
'reverse': reverse
},
);
QueryResult result = await _graphQLClient!.mutate(removeLineItem);
checkForError(result, key: 'cartLinesRemove', errorKey: 'userErrors');
return Cart.fromJson(
((result.data!['cartLinesRemove'] ?? const {})['cart'] ?? const {}));
}