Skip to main content
added 77 characters in body
Source Link

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"}}){
  items{
    name
  }
 }
}

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?

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"}}){
  items{
    name
  }
 }
}

This query returns an empty items array. 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?

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"}}){
  items{
    name
  }
 }
}

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?

Source Link

Using GraphQL query and filtering products by category_id, I get empty items array

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"}}){
  items{
    name
  }
 }
}

This query returns an empty items array. 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?