cli icon indicating copy to clipboard operation
cli copied to clipboard

[Bug]: The "Cookie banner" keeps appearing after every reload in the localhost server

Open karreiro opened this issue 11 months ago • 21 comments

The "Cookie banner" keeps appearing after every reload on the localhost server.

Expected behavior

The "Cookie banner" should not appear after every reload on the localhost server:

Image

Actual behavior

It should work just like the preview URL.

Reproduction steps

  • Activate the banner at /settings/privacy/consent-banner
  • Clone Dawn using shopify theme init
  • Run shopify theme dev
  • Notice it keeps appearing after every refresh

karreiro avatar Jan 13 '25 14:01 karreiro

The issue is not with the CLI but with the privacy banner itself. When a visitor tries to save their cookie preference by selecting either of the options, the cookie banner makes a POST request to https://127.0.0.1:9292/api/unstable/graphql.json.

Since the local dev server doesn't support SSL, the request fails and the user's preference is not saved.

As a workaround, you can prefix your local URL with ?pb=0 to keep the banner hidden.

ranjan-purbey avatar Feb 07 '25 19:02 ranjan-purbey

Unfortunately that's not a sustainable solution - it's fine if you're only working on one page, but if you navigate around the store then the issue will continue.

verdant-spark avatar Feb 27 '25 20:02 verdant-spark

Hi @ranjan-purbey @verdant-spark I work for the Privacy and Compliance team and we will take a look and check if it is possible to disable the banner in these local envs. Looks like the banner lib and the cookie are not working properly in local development env.

Truja avatar Feb 28 '25 14:02 Truja

Thanks, @Truja. Any news yet? The banner keeps showing up and it is super annoying. Especially in mobile view one has to click accept/decline every time as it blocks the whole view. Additionally, the cookie banner reappears with every HMR reload, forcing repeated interactions even after previous acceptance/rejection.

jo-ced avatar Mar 21 '25 11:03 jo-ced

@jo-ced I am going to add this issue to my next week things.

Truja avatar Mar 27 '25 19:03 Truja

Temporary work-around listed here: https://community.shopify.dev/t/shopify-cookiebar-cannot-dismiss-pernamently-on-localdev-customizer/9479/5?u=ceri_waters

ceri-waterscreative avatar Apr 09 '25 09:04 ceri-waterscreative

Any update on this @karreiro?

lukecharle avatar Apr 09 '25 09:04 lukecharle

Temporary work-around listed here: https://community.shopify.dev/t/shopify-cookiebar-cannot-dismiss-pernamently-on-localdev-customizer/9479/5?u=ceri_waters

Thank you so much @ceri-waterscreative. Your code snippet solves the issue.

I'll post it below in case the link stops working:

In theme.liquid add:

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

jo-ced avatar Apr 14 '25 10:04 jo-ced

This issue seems inactive. If it's still relevant, please add a comment saying so. Otherwise, take no action. → If there's no activity within a week, then a bot will automatically close this. Thanks for helping to improve Shopify's dev tooling and experience.

P.S. You can learn more about why we stale issues here.

github-actions[bot] avatar May 27 '25 03:05 github-actions[bot]

This is still happening - please keep this issue open and solve it!

verdant-spark avatar May 27 '25 08:05 verdant-spark

This issue seems inactive. If it's still relevant, please add a comment saying so. Otherwise, take no action. → If there's no activity within a week, then a bot will automatically close this. Thanks for helping to improve Shopify's dev tooling and experience.

P.S. You can learn more about why we stale issues here.

github-actions[bot] avatar Jul 09 '25 03:07 github-actions[bot]

@Truja are you still to be looking at this? It's so super annoying.

verdant-spark avatar Jul 09 '25 04:07 verdant-spark

I just did a test and looks like the problem is fixed: https://screenshot.click/07-46-p1c5t-l0oan.mp4

Please, let me know if you still notice it.

Truja avatar Aug 07 '25 21:08 Truja

@Truja Nope, the issue is still there, as you can see here: https://github.com/user-attachments/assets/c6c53ba0-af3f-4b85-bfbb-e0c702b0c240

I'm running shopify theme dev using the current latest version (3.83.3)

MassimilianoLattanzio avatar Aug 11 '25 13:08 MassimilianoLattanzio

@Truja - still present for me too. Also on 3.83.3

verdant-spark avatar Aug 11 '25 14:08 verdant-spark

Oh, it is happening when you run the theme specifically ... Thanks @MassimilianoLattanzio @verdant-spark I will test later today

Truja avatar Aug 11 '25 15:08 Truja

@MassimilianoLattanzio @verdant-spark Could you please retest ?? We merged a solution. Thanks

Truja avatar Aug 22 '25 05:08 Truja

@Truja Not yet solved, unfortunately. https://github.com/user-attachments/assets/bb750c83-636c-4df8-beed-b1e4b2a7ab60

I'm using 3.84.0 version

MassimilianoLattanzio avatar Aug 22 '25 07:08 MassimilianoLattanzio

happens to me too. Any news?

plcdnl avatar Sep 01 '25 18:09 plcdnl

How is this not fixed yet? Very annoying.

jacobgraf avatar Sep 28 '25 16:09 jacobgraf

Yep experiencing this (again)

ygroenendijk avatar Oct 13 '25 14:10 ygroenendijk