[BUG REPORT] GraphQL API productVariants product_status query not working

I’m trying to get only active product variants in the productVariants query.

The problem is that when I use the product_status query parameter just like the documentation says, then the query doesn’t return any variant at all (even though I do have active products)

I’m using the latest GraphQL API version. You can even reproduce the issue in GraphiQL. Here’s my query:

  query {
    productVariants(first: 200, query: "product_status:ACTIVE") {
      nodes {
        id
        displayName
      }
      pageInfo {
        endCursor
        hasNextPage
      }
    }
  }

I should also mention that I tried using “status” instead of “product_status” (even though it doesn’t appear in the docs) and it doesn’t work either, as it doesn’t filter anything.

Any help is appreciated, thank you.

Found the solution: for some reason it works when you use the status value in lowercase instead of uppercase:

query {
    productVariants(first: 200, query: "product_status:active") {
      nodes {
        id
        displayName
      }
      pageInfo {
        endCursor
        hasNextPage
      }
    }
  }

I’d argue that it may be the case that the documentation is wrong, because it even shows the example in uppercase:

Hey again @Pridentt, thanks for flagging this issue as well. I’ll report this internally and see if we can confirm if the docs need to be updated.

I’ll loop back with you here once I have more info :slight_smile:

1 Like

Thank you again @Alan_G! :saluting_face:

No worries @Pridentt, happy to help! Just wanted to loop back with you here. We’ve pushed a fix to the dev docs. It isn’t live just yet, but should be soon.

Just wanted to confirm that the lower case values are the correct ones, and we’re updating the docs to reflect that. Thanks again for flagging this, super appreciated! :slight_smile:

Thank you for following up @Alan_G , and yes the lowercase values are working for me :flexed_biceps:

1 Like