I am going to add Age verification block on Home page. for that i want to set session or cookie variable. so that i can check it through out all pages of store weather age verification session or cookie set or not.
Magento – How to Use Session or Cookie in Magento 2.0
cookiecustomer-sessionmagento2
Best Answer
You can use the below classess to set cookie and session in your block by passing into dependency.
For reference link
Hope it helps.