Hi Shopify Community,
I’m running into what appears to be either a documentation inconsistency or unexpected
behavior with the onlineStoreUrl field on the Product object when combined with the
published_status:online_store_channel query filter.
The Query
query CheckOnlineStoreChannel {
products(first: 10, query: "published_status:online_store_channel") {
nodes {
id
title
status
onlineStoreUrl
}
}
}
Expected Behavior
According to the https://shopify.dev/docs/api/admin-graphql/latest/objects/Product:
onlineStoreUrl — “The product’s URL on the online store. If null, then the product
isn’t published to the online store sales channel.”
I’d expect the published_status:online_store_channel filter to only return products
that are published to the online store, thus all returned products should have a
non-null onlineStoreUrl.
Actual Behavior
All products in the result have onlineStoreUrl: null despite being returned by the
online_store_channel filter.
Has anyone else run into this? Is this a docs issue or a bug? Any clarification from
the Shopify team would be appreciated.
Thanks!
Hey @Md_Maruf_Ahmed
I looked into this internally and found that the filter is working correctly, but onlineStoreUrl has an additional condition the docs don’t mention. If your store has password protection enabled, the field returns null for every product regardless of publication status. Development stores are always password protected and that protection can’t be removed until the store is transferred to a merchant or switched to a paid plan, so this is the most likely cause.
The published_status:online_store_channel filter checks whether a product has been added to the Online Store channel. The onlineStoreUrl field evaluates separately and requires that the product is published, has an ACTIVE status, and that the store has no password protection. Your results also include DRAFT products, which would return null even on a store without password protection since only ACTIVE products generate a storefront URL.
If you need the URL while password protection is in place, you can construct it from the shop’s primary domain and the product handle (e.g. https://{domain}/products/{handle}). That pattern holds for standard Online Store setups. To confirm password protection is the cause, you could test the same query on a store with a paid plan and no password enabled.
The docs description for this field (“If null, then the resource is currently not published to the Online Store sales channel”) is incomplete since password protection is another reason for a null return. I’ll raise that with the relevant team so the documentation can be updated.
Yes, im on a dev store which is password protected. Thanks for the clarification.
1 Like