How to filter Admin API products by (current) publication

Topic summary

Filtering products in the Admin GraphQL API by the current publication (sales channel) without extra requests. The goal was to avoid fetching the publication ID or retrieving publishedOnCurrentPublication for client-side filtering.

Initial concern: The older approach using a channel visibility filter appeared broken and would require additional calls. An interim idea was to request publishedOnCurrentPublication and filter locally, increasing traffic.

Resolution: The filter still works in GraphQL if the published_status value is enclosed in single quotes. Missing quotes caused Shopify to silently not parse the query.

Working example: query: “published_status:‘pos:visible’ OR published_status:‘online_store:hidden’”. Replace channel names and visibility as needed (hidden|visible).

Outcome: Server-side filtering by channel visibility is possible without fetching the publication ID. Issue resolved; no further action items noted.

Summarized with AI on December 23. AI used: gpt-5.

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

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.


[quote=“brdata”]
@HerculesApps

A bit late, but here’s what worked for me.

You need to enclose the channel-name and visibility in quotes.
[/quote]

query: "published_status:'pos:visible' OR published_status:'online_store:hidden'"