I try to make a simple request using graphql and to get a response from my magento. I have a parent category named Products(id:"3"). In this one, there are 3 subcategories A(id:"5"),B(id:"6"),C(id:"7") for example. Each subcategory has a single product assigned. I use the products query and filter products by category_id like:

 products(filter: {category_id: {eq:"5"}}){

This query returns an empty items array, and does the same for all subcategory ids (B with id:"6" and C with id:"7"). Based on the example i provided above it should return the product of category A, am i missing something? Although using the same query with eq:"3" returns all the products. Is there something special with subcategories and this query returns only parent category?

1 Answer 1


Your query is fine. I have copied it locally and I have results.

So, I would look at your Magento system trying to remove the graphql from the equation.

For instance, go to your Magento backend, fetch the url-key for the category 5. Then hit in your browser the category url.

I suspect you won't have products either. Then, to resolve this, you may look at reindexing your system

php bin/magento inde:reind may help if that was the case.

  • Tried everything you suggested without getting a result. Although deleting subcategories and creating new solved the problem. Maybe something was bugged, but didn't figure out why. Thanks for the reply anyway! Commented Oct 3, 2020 at 10:20
  • Excellent, thanks for the feedback Commented Oct 3, 2020 at 10:24

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.