Example: I have 2 observer classes.
1- category.php
2- product.php
I want to store the category.php data in a session variable, like $_SESSION['category']= $data; and call that session in product.php class.
Hello @rababfzepcc1fc
Please refer the below URL for the solution:
https://stackoverflow.com/questions/34170544/magento-2-0-set-session-variable
Thank you.
when I try to unset the session variable by using
$block->getCatalogSession()->unsProductId();
that unset method unset the overall session and my site stop working.
What I want is: I need to get the session value and insert it into the database after that unset that session value.