Product onlineStoreUrl

Solved
nbenoit
Shopify Partner
5 0 1

I'm coming across some unexpected behavior with the 2019-07 graphql storefront api. The docs state that a product's onlineStoreUrl will be null if the product is not published on the online store. My store has two sales channels, the app I am developing as well as the online store, even when products are published for both channels, products are still returned with a null onlineStoreUrl.

 

Screen Shot 2019-09-13 at 1.11.41 PM.png

 

Here is my query:
```
curl -X POST \
"https://quiq-convocom-demo-1.myshopify.com/api/2019-07/graphql.json" \
-H "Content-Type: application/graphql" \
-H "X-Shopify-Storefront-Access-Token: <...>" \
-d '
{
productByHandle(handle: "test-product") {
id
handle
onlineStoreUrl
}
}
'
```

 

And here is what is returned:
```

{
"data": {
"productByHandle": {
"id": "Z2lkOi8vc2hvcGlmeS9Qcm9kdWN0LzIzMTUxNzU3ODg2NDA=",
"handle": "test-product",
"onlineStoreUrl": null
}
}
}

```

 

I have other test stores setup in what I think is the same way, these stores return a valid onlineStoreUrl. For reference the store I am having trouble with is: `https://quiq-convocom-demo-1.myshopify.com/` and the store that is working as I expect `https://standalone1-demo.myshopify.com`.

 

Happy to provide any additional details as well.

 

Thanks,

Nick

nbenoit
Shopify Partner
5 0 1

Anyone have any thoughts?

0 Likes
sd_
Shopify Staff (Retired)
Shopify Staff (Retired)
51 10 5

This is an accepted solution.

Hi Nick,

 

You are correct that the `onlineStoreUrl` will be `null` if a product is not published to the online store. It is important to note as well that if your store is password protected (meaning in the settings of your stores Shopify admin dashboard, you have the password page enabled) `onlineStoreURL` will also be returned as null.

 

This is something that is currently not clearly noted documentation and so we will work on making this more clear as necessary.

 

Cheers

djevox
Tourist
5 0 1

How are we supposed to create partner apps when we can't unpassword protect the app to get the onlineStoreUrl? Is there something I'm missing on setup, or a way around this so I can test that onlineStoreUrl works?