Shopify Cookiebar - cannot dismiss pernamently on localdev/customizer

Hiya,

So with Shopify’s native cookie bar… it doesn’t correctly set the cookie when within the customizer or running shopify theme dev with the CLI.

It therefore re-displays on every page reload or file-size, making it quite frustrating.

I believe this is because the Cookie Bar App is trying to set a cookie against the incorrect domain, and then there’s also iframe resrictions.

Unsure if this requires a change to the Cookiebar itself, or if it requires a change in the customizer and CLI.

As a temporary work-around you can hide it with CSS, but it has risks:

  • You have to rely on the depricated theme.role property to determine it’s a dev theme
  • Or you have to remember to remove the CSS and hope you don’t commit it to production…

Happy to provide videos/examples if needed.

Thanks!

1 Like

This has been raised over on the CLI GitHub, just still waiting for a fix! :frowning:

Hi Luke - can you share the link to the GH issue and we can then comment/+1 it over there to maybe help it get some traction.

Please see here → [Bug]: The "Cookie banner" keeps appearing after every reload in the localhost server · Issue #5186 · Shopify/cli · GitHub

I know a few are frustrated by this, here’s a temporary work-around for now:

{%- if theme.role == "development" or request.design_mode -%}
    {% style %}
        #shopify-pc__banner {
            display:none!important;
        }
    {% endstyle %}
{%- endif -%}
1 Like