11

After upgrading from Magento 2.4.2 to 2.4.3 the message

The store will not work correctly in the case when cookies are disabled.

Is displayed on all pages.

3
  • I have the same issue on 2 stores after updating, have you found a solution? I also have an issue when HTML minification is enabled after the update. Commented Aug 16, 2021 at 11:07
  • Check this issue - github.com/magento/magento2/issues/33811
    – paj
    Commented Aug 16, 2021 at 16:17
  • 1
    Yeah, I posted the solution on that issue after looking for a fix. Commented Aug 16, 2021 at 19:54

5 Answers 5

12

I just encountered the same issue when updated to Magento 2.4.3. As a solution, I have added a layout XML file, which removes the "cookie-status-check" block.

In app\design\frontend\{my_theme}\Magento_Theme\layout\default_head_blocks.xml, where {my_theme} is my custom theme or the theme which is used by the frontend.

I added the following xml, which tells to remove the above mentioned block.

<?xml version="1.0"?>
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
    <body>
        <referenceBlock name="cookie-status-check" remove="true"/>
    </body>
</page>

By the way, I am in developer mode. So, if the block is not removed when you add this code, please clear your caches and deploy the static files if needed.

Also, we are overriding the below file from "Magento_Theme" module. vendor/magento/module-theme/view/frontend/layout/default_head_blocks.xml.

Please note if the browser has actually disabled cookies then the warning message won't be shown.

Please refer the official issue is below: https://github.com/magento/devdocs/issues/9095

6

This issue is caused by a change in M2.4.3 and how it handles the cookie status message.

If you are using a custom theme add the following to Magento_Theme/web/css/source/_module.less

.cookie-status-message {
    display: none;
}

Update: this issue is fixed in Magento 2.4.4

2
  • Does not work for me
    – Black
    Commented Sep 24, 2021 at 11:04
  • I did some research since just removing the message with CSS seemed a bit odd. But it seems to be the correct way since this is the way Magento implemented in 2.4.3. Hidden by default and show it when needed. A good explainations is found here: github.com/magento/magento2/issues/33796#issuecomment-899619874
    – Akif
    Commented Oct 5, 2021 at 15:26
2

The store will not work correctly in the case when cookies are disabled. You need to create the file and add code. app/design/frontend/vendor_theme/theme_name/Magento_Theme/templates/js/cookie_status.phtml Add code below it working for me.

<?php
/**
 * Copyright © Magento, Inc. All rights reserved.
 * See COPYING.txt for license details.
 */

/** @var \Magento\Framework\View\Helper\SecureHtmlRenderer $secureRenderer */
?>

<div id="cookie-status">
    <?= $block->escapeHtml(__('The store will not work correctly in the case when cookies are disabled.')); ?>
</div>
<?php
$script = 'document.querySelector("#cookie-status").style.display = "none";';
?>
<?= /* @noEscape */ $secureRenderer->renderTag('script', ['type' => 'text/javascript'], $script, false); ?>

<script type="text/x-magento-init">
    {
        "*": {
            "cookieStatus": {}
        }
    }
</script>
2

On Magento 2.4.3

The store will not work correctly in the case when cookies are disabled. fixes on Potro 2 theam

Store > Configuration > Porto - Settings Panel > Customization Settings > Custom Style 1 >

Add this code

.cookie-status-message {
display: none;
}
0

This is a M 2.4.3 upgrade specific issue. Try the following: (for porto)

Add app/design/frontend/Smartwave/porto/Magento_Theme/web/css/source/_module.less:

.cookie-status-message {

display: none;

}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.