checkoutCustomerAssociate method

Future<void> checkoutCustomerAssociate(
  1. String checkoutId,
  2. String customerAccessToken, {
  3. bool deleteThisPartOfCache = false,
})

Associates the Customer that customerAccessToken belongs to, to the Checkout that checkoutId belongs to.

Implementation

Future<void> checkoutCustomerAssociate(
    String checkoutId, String customerAccessToken,
    {bool deleteThisPartOfCache = false}) async {
  final MutationOptions _options = MutationOptions(
      document: gql(associateCustomer),
      variables: {
        'checkoutId': checkoutId,
        'customerAccessToken': customerAccessToken
      });
  final QueryResult result = await _graphQLClient!.mutate(_options);
  checkForError(
    result,
    key: 'checkoutCustomerAssociateV2',
    errorKey: 'checkoutUserErrors',
  );
  if (deleteThisPartOfCache) {
    _graphQLClient!.cache.writeQuery(_options.asRequest, data: {});
  }
}