FROM CACHE - en_header

Product published_status vs status

Solved
sengming
Shopify Partner
26 1 1

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?
Accepted Solution (1)

Accepted Solutions
syf_
Shopify Staff
Shopify Staff
95 20 19

This is an accepted solution.

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.

syf_ | Developer Support @ Shopify 
 - Was my reply helpful? Click Like to let me know! 
 - Was your question answered? Mark it as an Accepted Solution
 - To learn more visit Shopify.dev or the Shopify Web Design and Development Blog

View solution in original post

Replies 5 (5)
syf_
Shopify Staff
Shopify Staff
95 20 19

This is an accepted solution.

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.

syf_ | Developer Support @ Shopify 
 - Was my reply helpful? Click Like to let me know! 
 - Was your question answered? Mark it as an Accepted Solution
 - To learn more visit Shopify.dev or the Shopify Web Design and Development Blog

sengming
Shopify Partner
26 1 1

Thank you @syf_ for the thorough answer!

sergiu_cazac
Shopify Partner
3 0 1

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.

diadev
Tourist
6 0 1

@syf_ 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.

diadev
Tourist
6 0 1

Also @syf_ , 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).