Storing data / session for anonymous user I am working on a shop, and for the cart, i need to store items before payment.

  $tempstore = \Drupal::service('user.private_tempstore')-&gt;get('boutique');
  $tempstore-&gt;set('poids', $form_state-&gt;getValue('poids'));


I take a look on the user service for : 


  pivate_tempstore and shared_tempstore


But that work only for authenticates users.

What can I use for store data ? $_SESSION ? or Drupal 8 has a service for that ?
Late answering, but it's worth mentioning that you can use private tempstore for anonymous users, as long as the tempstore has access to an active session. To do so, you need to inject your class with services for the temp store, session, and current user, like so:

public function __construct(PrivateTempStoreFactory $temp_store_factory, SessionManagerInterface $session_manager, AccountInterface $current_user) {
    $this-&gt;tempStoreFactory = $temp_store_factory;
    $this-&gt;sessionManager = $session_manager;
    $this-&gt;currentUser = $current_user;

    $this-&gt;store = $this-&gt;tempStoreFactory-&gt;get('myclass.storename');
}

public static function create(ContainerInterface $container) {
    return new static(
        $container-&gt;get('user.private_tempstore'),
        $container-&gt;get('session_manager'),
        $container-&gt;get('current_user')
    );
}


Then you just need to ensure you start the session manager if the user is anonymous, before you need to put anything in the temp store:

if ($this-&gt;currentUser-&gt;isAnonymous() &amp;&amp; !isset($_SESSION['session_started'])) {
    $_SESSION['session_started'] = true;
    $this-&gt;sessionManager-&gt;start();
}


You might find this approach preferable because it means that you can use a single system for temporary storage, regardless of whether a user is logged in.

(My code examples are lifted more-or-less verbatim from this excellent tutorial on building multi-step forms.)