shippingAddressUpdate method
Updates the shipping address on given checkoutId
Implementation
Future<Checkout> shippingAddressUpdate(
String checkoutId,
Address address,
) async {
Map<String, dynamic> variables = address.toJson();
variables['checkoutId'] = checkoutId;
final MutationOptions _options = MutationOptions(
document: gql(checkoutShippingAddressUpdateMutation),
variables: variables,
);
final QueryResult result = await _graphQLClient!.mutate(_options);
checkForError(
result,
key: 'checkoutShippingAddressUpdateV2',
errorKey: 'checkoutUserErrors',
);
return Checkout.fromJson(
((result.data!['checkoutShippingAddressUpdateV2'] ??
const {})['checkout'] ??
const {}));
}