removeLineItemsFromCheckout method
Returns the Checkout that checkoutId
belongs to after removing the lineItems
from it.
Implementation
Future<Checkout> removeLineItemsFromCheckout({
required String checkoutId,
required List<LineItem> lineItems,
}) async {
final MutationOptions _options = MutationOptions(
document: gql(removeLineItemsFromCheckoutMutation),
variables: {
'checkoutId': checkoutId,
'lineItemIds': [for (var lineItem in lineItems) lineItem.id],
});
final QueryResult result = await _graphQLClient!.mutate(_options);
checkForError(
result,
key: 'removeLineItemsFromCheckout',
errorKey: 'checkoutUserErrors',
);
return Checkout.fromJson(
((result.data!['checkoutLineItemsRemove'] ?? const {})['checkout'] ??
const {}));
}