checkoutShippingLineUpdate method
Removes the Gift card that appliedGiftCardId
belongs to, from the Checkout that checkoutId
belongs to.
Implementation
Future<Checkout> checkoutShippingLineUpdate(
String checkoutId, String shippingRateHandle,
{bool deleteThisPartOfCache = false}) async {
final MutationOptions _options = MutationOptions(
document: gql(checkoutShippingLineUpdateMutation),
variables: {
'shippingRateHandle': shippingRateHandle,
'checkoutId': checkoutId
});
final QueryResult result = await _graphQLClient!.mutate(_options);
checkForError(
result,
key: 'checkoutShippingLineUpdate',
errorKey: 'checkoutUserErrors',
);
if (deleteThisPartOfCache) {
_graphQLClient!.cache.writeQuery(_options.asRequest, data: {});
}
return Checkout.fromJson(
((result.data!['checkoutShippingLineUpdate'] ?? const {})['checkout'] ??
const {}));
}