Our Partner & Developer boards on the community are moving to a brand new home: the .dev community forums! While you can still access past discussions here, for all your future app and storefront building questions, head over to the new forums.

Why is this filter not working on productVariants?

Why is this filter not working on productVariants?

bilaltahir21
Shopify Partner
1 0 0

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. 

 

 

Reply 1 (1)

Kyle_liu
Shopify Partner
429 53 74

Hi @bilaltahir21 

 

status:ACTIVE,DRAFT

query {
    productVariants(query: "status:ACTIVE,ARCHIVED,DRAFT", first: 5) {
        edges {
            node {
                id
             }
       }
   }
}
If this is helpful, please Like and Accept the solution.
Want to modify or custom changes on store? Let me help.
- Feel free to contact me Email Me Buy Me A Coffee