When attempting to filter products based on whether or not the products are published to our sales channel, nothing that is documented seems to be working as documented here products - GraphQL Admin
Specifically, I’m trying to filter the product list such that on the returned products the publishedOnCurrentPublication field is true.
I’ve tried finding the publication id of the current publication and running publication_ids:'gid://shopify/Publication/{long}' as well as publication_ids:{long}
I’ve tried filtering the products down by the publishable_status field with all of publishable_status:published ← This one returns products that are publish to any publication not just our sales channel
I’ve tried finding my publication id and running publishable_status:{publicationId}:published as well as publishable_status:{pubId}-published because both are documented, and obtaining results with warning of
"warnings": [
{
"field": "publishable_status",
"message": "Input `{input}` is not an accepted value."
}
]
Has anyone else had any luck trying to correctly filter for products that are published to your sales channel?
I did some testing with this and believe I see the issue. When using publication_ids with a specific ID, you need to wrap the ID in single quotes to make it work properly.
For example, this works correctly:
publication_ids:'121366675478'
This is being parsed as a “match phrase” query. Without the quotes, it’s parsed as a “match all” query, which doesn’t give the expected results. Alternatively, you could use escaped double quotes like publication_ids:\"121366675478\" if you’re building the query string programmatically.
I was able to find this out using the debugging headers mentioned in the last section of our search syntax docs: Shopify API search syntax. They help to show exactly how your query is being parsed behind the scenes which is super helpful for figuring out why certain queries aren’t working as expected!
I have the same issue as everyone else. I’m ultimately interested in writing a query filter that will only return products visible / published on the Online Store sales channel. The following query returns a product (id=1234). The resourcePublications and productPublications confirm that this product is in the Online Store sales channel (publication id 5678, app id 9012). The publishedOnPublication field returns true for this product in the Online Store.
If I modify the query to include the publishable_status filter, I get more or less the same results that AshCloudshelf reported earlier. Doesn’t seem to matter if I use the app id, publication id, online_store_channel, long or short form of the ids, visible, or published, single quotes or without single quotes. I either get no results or the message that the input is not an accepted value.
Hey all! Sorry for the delay here. I really appreciate all of the feedback. I’ve dug in to this some more and this is a known issue that we are working on resolving. I don’t have a timeline on a fix currently but I will update here once we do.