A space to discuss GraphQL queries, mutations, troubleshooting, throttling, and best practices.
Hi, ideally I would like to query only for products published to the current (i.e. the app's) publication. I've stumbled across a similar older question that suggested using the "product_status" filter with a value of "[channel_name]:[hidden|visible]". However, not only would require separately fetching the publication's ID, it does not appear to work anymore (as outlined in the linked thread).
Is there an alternative available? My current solution would be to request the "publishedOnCurrentPublication" field and filter afterward using that. This generates additional traffic though that I would like to avoid if possible.
Regards
Leon Linhart
Solved! Go to the solution
This is an accepted solution.
It turned out that the syntax is still valid and this is possible even with GraphQL in my use-case. My specific issue was missing single quotes around the value for the "published_status" parameter. For some reason, Shopify didn't raise any error even when it didn't parse the query as expected.
Credit goes to Brdata's response here.
@brdata wrote:A bit late, but here's what worked for me.
You need to enclose the channel-name and visibility in quotes.
query: "published_status:'pos:visible' OR published_status:'online_store:hidden'"
This is an accepted solution.
It turned out that the syntax is still valid and this is possible even with GraphQL in my use-case. My specific issue was missing single quotes around the value for the "published_status" parameter. For some reason, Shopify didn't raise any error even when it didn't parse the query as expected.
Credit goes to Brdata's response here.
@brdata wrote:A bit late, but here's what worked for me.
You need to enclose the channel-name and visibility in quotes.
query: "published_status:'pos:visible' OR published_status:'online_store:hidden'"