Product published_status vs status

Hi!

I’ve noticed from the Products search API https://shopify.dev/docs/admin-api/rest/reference/products/product#index-2020-07

That there are options to search by published_status and status. Are these two fields related? For example does status=active imply that published_status=published ?

If they are not the same:

  • how are they different?
  • how would I query for products with status=active on the admin graphql, since we can only query by published_status field on that API?

Hi @sengming ,

I’d try to explain the difference between the the status and published_status fields of the Product resource, and hopefully I can clarify any confusion you have.

For the Rest API,

  • the status field of a Product resource indicates the product status. Possible values are active, draft, or archived.

  • the published_status of a Product resource indicates what channel the product is available on. Using the values published, unpublished, or any, the channel used is the online store. There is flexibility to select products from a specific channel also. You can use the following [channel_name]:[hidden|visible] as the value (the value should be url encoded). For example finding all products published on the Buy Button channel would use /admin/api/2020-10/products.json?published_status=buy_button%3Avisible (url encoded).

To answer your question about how to query for products that have an active status using GraphQL, see the example below

{
  products(first:10, query: "status:active") {
    edges {
      node {
        id
        status
      }
    }
  }
}

I hope this helps, and the differences between the status and published_status fields are clearer now.

Best,

Seth.

Thank you @syf_1 for the thorough answer!

I am trying it using the 2020-10 API version and the status field doesn’t seem to be supported. The documentation also doesn’t show that it is supported.

Edited: Figured it out. I had an error in the syntax.

@syf_1 Could you please document the query syntax for the

published_status

field as it pertains to specific sales channels? You mentioned the

[channel_name]:[hidden|visible]

syntax… could you please add this to the official Shopify documentation?

Thanks.

Also @syf_1 , if possible show how to use that syntax to query for visible to a private app which is acting as a sales channel (e.g. doesn’t show up in the “Sales Channel” list in the main admin nav, but is on the list for publish/unpublish for products).

How does published_status works in a the GraphQL query search syntax?

I tried

query: "published_status:[channel-name]:visible"

And also tried

query: "published_status:[channel-name]=visible"

Hope someone can explain the right solution.

@HerculesApps

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'"