1

This question already has an answer here:

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?

marked as duplicate by kiamlaluno May 9 '16 at 12:33

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

2

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.