diff --git a/app/code/Magento/Cookie/Helper/Cookie.php b/app/code/Magento/Cookie/Helper/Cookie.php index f413cd046e45d..d842489a3e2dd 100644 --- a/app/code/Magento/Cookie/Helper/Cookie.php +++ b/app/code/Magento/Cookie/Helper/Cookie.php @@ -69,11 +69,22 @@ public function __construct( public function isUserNotAllowSaveCookie() { $acceptedSaveCookiesWebsites = $this->_getAcceptedSaveCookiesWebsites(); + return $this->isCookieRestrictionModeEnabled() && + empty($acceptedSaveCookiesWebsites[$this->_website->getId()]); + } + + /** + * Check if cookie restriction mode is enabled for this store + * + * @return bool + */ + public function isCookieRestrictionModeEnabled() + { return $this->scopeConfig->getValue( self::XML_PATH_COOKIE_RESTRICTION, \Magento\Store\Model\ScopeInterface::SCOPE_STORE, $this->_currentStore - ) && empty($acceptedSaveCookiesWebsites[$this->_website->getId()]); + ); } /** diff --git a/app/code/Magento/Cookie/view/frontend/templates/html/notices.phtml b/app/code/Magento/Cookie/view/frontend/templates/html/notices.phtml index e5e4438301902..21c280a384f4a 100644 --- a/app/code/Magento/Cookie/view/frontend/templates/html/notices.phtml +++ b/app/code/Magento/Cookie/view/frontend/templates/html/notices.phtml @@ -8,7 +8,7 @@ ?> -helper('Magento\Cookie\Helper\Cookie')->isUserNotAllowSaveCookie()): ?> +helper('Magento\Cookie\Helper\Cookie')->isCookieRestrictionModeEnabled()): ?>