Why can't I access the window.Shopify object for a cookies consent banner?

Hello! I’m trying to implement a cookies consent banner on my store (I’m using Shopify’s integration with Hydrogen.). The first step is to load the customer privacy API using the window.Shopify object. However, I can’t even see, much less access the Shopify property on my window object, it returns undefined. Am I missing something?

Thank you in advance!

Hi there, if you are using Hydrogen, I think you should take a look at this doc instead: https://shopify.dev/docs/api/hydrogen/2023-10/hooks/useshopifycookies

Hi! Thank you so much for replying, I didn’t notice that hook! It doesn’t seem like it supports all the methods from the Customer Privacy API though, like checking the user’s current permissions or customize the specific type of cookies that should be enabled/disabled, for example.

Did you find a solution to this? I have exactly the same issue, trying to access window.Shopify.loadFeatures, but getting undefined for the Shopify object. Would like to listen for when the Shopify object is attached to window. Unless there is something to listen for built in to Shopify.

I would not consider this an accepted solution to the challenge we experience.