I have a multi step custom made form in Drupal 8.2.x.

Some of the user input from the form needs to be shown on a separate block.

The following code worked fine for users that are logged in:

$tempstore = \Drupal::service('user.private_tempstore')->get('mymodule_name');
$tempstore->set('my_variable_name', $some_data);

But it doesn't work for anonymous users on my site.

Is there a tempstore for anonymous users that works site wide that I just haven't discovered yet?


you should use session manager for storing current sessions for anonymous users

private_tempstore gives us a temporary store that is private to the current user

refer to this link asked some days ago session storage for anonymous users

Not the answer you're looking for? Browse other questions tagged or ask your own question.