Why is this filter not working on productVariants?

Topic summary

A user is encountering issues filtering productVariants by parent product status using the GraphQL Admin API.

Problem:

  • The filter product_status:ACTIVE,ARCHIVED,DRAFT returns empty results despite working syntax
  • Pagination alone works correctly
  • The goal is to filter variants based on their parent product’s status

Proposed Solution:
Another user suggests using status:ACTIVE,DRAFT instead of product_status, indicating the filter parameter may be incorrectly specified.

Current Status:
The discussion remains open with one potential solution offered but not yet confirmed as working. The core issue appears to be incorrect filter syntax rather than a fundamental API limitation.

Summarized with AI on November 5. AI used: claude-sonnet-4-5-20250929.

I am trying to fetch productVariants using GraphQL query. It works fine when I use just the pagination but it does not work when I add the filter product_status. Here are my query and response.

Working Scenario:
Query

query {
    productVariants(query: "product_status:ACTIVE,ARCHIVED,DRAFT", first: 5) {
        edges {
            node {
                id
             }
       }
   }
}

Response:

{
  "data": {
    "productVariants": {
      "edges": []
    }
  },
  "extensions": {
    "cost": {
      "requestedQueryCost": 5,
      "actualQueryCost": 2,
      "throttleStatus": {
        "maximumAvailable": 2000,
        "currentlyAvailable": 1998,
        "restoreRate": 100
      }
    }
  }
}

I want to filter variants on their parent product’s status.

Hi @bilaltahir21

status:ACTIVE,DRAFT

query {
    productVariants(query: "status:ACTIVE,ARCHIVED,DRAFT", first: 5) {
        edges {
            node {
                id
             }
       }
   }
}
1 Like