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.

In some countries there should be a pop-up saying something like “This site uses Cookies. Agree to Use Cookies”. In such cases some operations are not enabled unless a user agrees on using Cookies.

Where can you configure Cookies in Magento 2.0?

Go to Stores > Configuration > (General) > Web > Default Cookie Settings

Cookies in Magento 2.0

Cookies Configuration

  • 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 “” (make sure there is a “.” before your domain name).
  • Use HTTP Only. To prevent your store from Malware, select “Yes” here. It uses HTTP protocol only and doesn’t allow other protocols such as JavaScript.
  • Cookie Restriction Mode. You need to select “Yes” here.

Where can I edit Cookies Policy?

Navigate to Content -> Pages.

Then select Privacy policy page and in “Action” column select “Edit”.


Select the store view where the Cookie Restriction message should appear and switch status to “Enabled”.

Cookies in Magento 2.0

Now go to Content tab and edit your Privacy Policy, press this button to switch to WYSIWYG editor mode:

Cookies in Magento 2.0

In this privacy policy describe what information your company collects and how it is used.

In default Magento 2.0 theme you can find it in footer:

Cookies in Magento 2.0

And here is how it looks on Frontend:

Cookies in Magento 2.0

Where can I change the popup message about Cookies?

Navigate to Content -> Pages

Then click to edit Enable Cookies page.

Cookies in Magento 2.0

Then enable this message. And select for which store views you want to apply it.

Then go to Content and edit the message.

Cookies in Magento 2.0

Edit the message

Here is how this message will look on default Magento theme:

Cookies in Magento 2.0

Default Magento Message

Viewed 882 Times

Post On 2022-12-05