Cookies in Magento 2
What are Cookies?
If as a user you enabled Cookies on a website, it will create small files on your computer where it saves some information. This information is then used to make your shopping experience more personal. For example, it saves information about your choice of language and next time you visit the website, it uses the language you selected previously.
Different countries have different policies regarding Cookies.
In some countries it’s implied that visitors know that Cookies are a necessary part of operations and when they use the website, they agree on Cookies.
Where can you configure Cookies in Magento 2.0?
Go to Stores > Configuration > (General) > Web > Default Cookie Settings
- Cookie Lifetime. It’s how long Cookie files stay on user’s computer. By default it’s set as 3600 seconds which is equal to about 1 hour. If you want to ensure that cookies expire when a user closes their browser, then select 0 here.
- Cookie Path. To make cookies available for some particular folders, enter the Cookie Path here. If you want them to be available anywhere on your site, then enter a “/”.
- Cookie Domain. If you want to enable cookies for a subdomain, enter it here. If you want to enable cookies for all subdomains, enter something like “.domain.com” (make sure there is a “.” before your domain name).
- Cookie Restriction Mode. You need to select “Yes” here.
Where can I edit Cookies Policy?
Navigate to Content -> Pages.
Select the store view where the Cookie Restriction message should appear and switch status to “Enabled”.
In default Magento 2.0 theme you can find it in footer:
And here is how it looks on Frontend:
Where can I change the popup message about Cookies?
Navigate to Content -> Pages
Then click to edit Enable Cookies page.
Then enable this message. And select for which store views you want to apply it.
Then go to Content and edit the message.
Here is how this message will look on default Magento theme: