shippingAddressUpdate method

Future<Checkout> shippingAddressUpdate(
  1. String checkoutId,
  2. Address address
)

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 {}));
}