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?”

How to delete cookie in Magento 2?

Magento 2, You can delete the cookie using Magento’s Own Magento\Framework\Stdlib\CookieManagerInterface interface class.

You can delete cookie using deleteCookie() function from CookieManagerInterface Interface. Continue reading “How to delete cookie in Magento 2?”