We're moving the community! Starting July 7, the current community will be read-only for approx. 2 weeks. You can browse content, but posting will be temporarily unavailable. Learn more

GraphQL Admin API products query

Solved

GraphQL Admin API products query

ansariafroz720
Shopify Partner
16 1 8

I am referring this doc 
https://shopify.dev/docs/api/admin-graphql/2024-04/queries/products?language=Remix&example=Get+the+f...

 

Could anyone please let me know what are the possible values for the 
query filter:
product_configuration_owner, product_publication_status, publishable_status, and published_status

For instance my query is

query {
    products(first: 10, query: "status:ACTIVE AND published_status:") {
      edges {
        node {
          id
          status
          handle
          title
          updatedAt
        }
      }
    }
  }

so what are the values that I can compare with the published_status

 

Accepted Solution (1)

ansariafroz720
Shopify Partner
16 1 8

This is an accepted solution.

I got the filter values for `published_status` which are published, unpublished and any.

query {
    products(first: 10, query: "status:ACTIVE AND published_status:published") {
      edges {
        node {
          id
          status
          handle
          title
          updatedAt
        }
      }
    }
  }

It worked. 

View solution in original post

Replies 5 (5)

awwaiid
Shopify Partner
1 0 0

I expected to see `publishedStatus` on the https://shopify.dev/docs/api/admin-graphql/2024-04/objects/Product Product Object definition, but I only see `status`. There is a separate object https://shopify.dev/docs/api/admin-graphql/2024-04/objects/ProductPublication that has an isPublished boolean, maybe that is what is getting mapped here.

ansariafroz720
Shopify Partner
16 1 8

@awwaiid I tried but it didn't work.

ansariafroz720
Shopify Partner
16 1 8

This is an accepted solution.

I got the filter values for `published_status` which are published, unpublished and any.

query {
    products(first: 10, query: "status:ACTIVE AND published_status:published") {
      edges {
        node {
          id
          status
          handle
          title
          updatedAt
        }
      }
    }
  }

It worked. 

IgorGorkov
Shopify Partner
5 0 0

Hi! 
I'm trying to make a similar request in the Shopify GraphiQL App and the following warning is displayed in my response:
01.png
There really are no such values for published_status in the manual: https://shopify.dev/docs/api/admin-graphql/2024-10/queries/products#argument-query-filter-published_... 

So the question arises: how correct is it to use such a query? Just ignore the warning? The results look correct.

ansariafroz720
Shopify Partner
16 1 8

@IgorGorkov, you are absolutely right. I'm also seeing the same warning now, and the documentation for all versions is much more detailed and improved compared to when I was looking for it. Although I did find those values somewhere back then, which I can't locate the link now, otherwise, I would have shared it. But it's good to see that we now have more comprehensive documentation to refer to.