How to get store code by store cookie Magento 2?

You can get the store code value from the cookie name store in Magento 2.

This article will be useful while you have multiple stores set up in your store.

While you switch any store from the site, Magento adds a logic to add a new cookie called store with a value containing the current selected store. Continue reading “How to get store code by store cookie Magento 2?”

How to check cookie restriction mode enabled programmatically Magento 2?

You can check the cookie restriction mode value enabled or not for the current store using Magento 2.

Cookie Restriction mode XML config path is ‘web/cookie/cookie_restriction’ and you can check the value for the specified store using Helper class.

Magento\Cookie\Helper\Cookie class contains public function isCookieRestrictionModeEnabled() to verify Mode is enabled for the current store. Continue reading “How to check cookie restriction mode enabled programmatically Magento 2?”

How to Retrieve Store code by cookie Magento 2?

You can get the current store code from the browser cookie using Magento.

Sometimes you required to detect store code before any request generated in a store and that time you will help this article. You can check the current store code in beforeDispatch() method of the request and verify for the current store code. Continue reading “How to Retrieve Store code by cookie Magento 2?”