This is the goal: Once user click on a link, product needs to be added to the basket, and order information page needs to appear, so user can fill it.
I've created a controller, and everything works, unless the user in anonymous. In that case, a "You are not authorized to access this page." error appears, and product is not added. However, (not sure if this is important), if the user visits a product first (just visit, without additional interaction), and then visit the link there is no that error. Also, if there are some items already in the added (with classic buttons), everything also works, for anonymous users as well.
I've used this to add the product: https://www.drupal.org/node/2866020
Shortly, it creates order item, and adds with cart manager.
and at the end, I've added
$cart_id = $cart->get('order_id')->getValue();
$cart_id_value = $cart_id[0]['value'];
$response = new RedirectResponse('/checkout/' .$cart_id_value.'/order_information');
$response->send();
return;
Any help or guidance will be appreciated.
Thanks