checkoutShippingLineUpdate method

Future<Checkout> checkoutShippingLineUpdate(
  1. String checkoutId,
  2. String shippingRateHandle
)

Returns Checkout that checkoutId belongs to, requires shipping.

Implementation

Future<Checkout> checkoutShippingLineUpdate(
  String checkoutId,
  String shippingRateHandle,
) 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',
  );

  return Checkout.fromJson(
      ((result.data!['checkoutShippingLineUpdate'] ?? const {})['checkout'] ??
          const {}));
}