How to manage age gate cookies in the theme editor?

Solved

How to manage age gate cookies in the theme editor?

richietyler
Shopify Partner
10 1 0

Hello Everyone, does any one have any experience with age gate cookies in relation to the Shopify Theme Editor ('Online Store' > 'Customize')?

 

I have an age gate set up with a 24hr cookie, but because the theme editor displays the site in a cross-domain iframe the cookies won't save, therefore I'm unable to get past the age gate to make changes via the editor.

 

Does anyone have any suggestions how to either apply conditional appearance of page elements when viewing the site in the theme editor (preferred because it would be better if the age gate never appears in the editor), or setting cross domain cookies to work within the iframe of the editor?

 

Any ideas much appreciated!

Accepted Solution (1)

richietyler
Shopify Partner
10 1 0

This is an accepted solution.

For anyone chasing a solution to this: I used one of the scripts detailed here to detect whether the site was being loaded in an iframe. From there, I simply hid the offending div using Javascript.

View solution in original post

Replies 2 (2)

richietyler
Shopify Partner
10 1 0

This is an accepted solution.

For anyone chasing a solution to this: I used one of the scripts detailed here to detect whether the site was being loaded in an iframe. From there, I simply hid the offending div using Javascript.

MaxDesign
Shopify Partner
213 15 84

Shopify.designMode javascript object lets you know whether the website is loaded within the theme editor or not.

Reach out to me at admin@maxdesign.expert