Filtering products by querying publication_status to a sales channel app does not work

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?

1 Like

Does publishable_status:published filter return some products?

Also, you need to use short publication ID, not long ID.
Example from Docs:
publishable_status:189769876:visible

Yeah none of those work unfortunatley

Currently having the same issue - is the documentation just wrong?

Also having this problem.

No ID I provide is accepted. AppID, ChannelID, with or without globalid.

Hey everyone!

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!

Let me know if that works for you.

Hey Kyle.

Thanks for trying, but this does NOT work with publishable_status.

I have tried the following:

publishable_status:‘6304021’:published
publishable_status:‘6304021:published’
publishable_status:‘6304021-published’
publishable_status:6304021:published

You are correct wrapping in quotes changes it to match_phrase, but with the feature we are trying to use this is the response:

"search": [
            {
                "path": [
                    "collections"
                ],
                "query": "publishable_status:'6304021':published",
                "parsed": {
                    "and": [
                        {
                            "field": "default",
                            "match_all": "published"
                        },
                        {
                            "field": "publishable_status",
                            "match_phrase": "6304021"
                        }
                    ]
                },
                "warnings": [
                    {
                        "field": "publishable_status",
                        "message": "Input `6304021` is not an accepted value."
                    }
                ]
            }
        ]

Edit: We are trying to use publishable_status as its available on both products & collections.

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.

query {
  products(first: 1, query: "id:1234") {
    edges {
      node {
        id
        handle
        publishedOnPublication(
          publicationId: "gid://shopify/Publication/5678"
        )
        resourcePublications(first: 99) {
          edges {
            node {
              publication {
                id
                name
              }
            }
          }
        }
        productPublications(first: 99) {
          edges {
            node {
              channel {
                app {
                  handle
                  id
                }
              }
            }
          }
        }
      }
    }
  }
}

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.

1 Like

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.

same issue here. hope to fix ASAP

Thanks Eric. I am still monitoring the issue on my end and will post here as soon as there is an update.