Filtering products using custom attributes in magento2 with graphql causes error: Field is not defined by type ProductAttributeFilterInput

Viewed 1339

I'm trying to filter products retrieved from my backend magento2 with custom attributes using graphql query as mentioned in official documentation:[https://devdocs.magento.com/guides/v2.4/graphql/custom-filters.htm] using attribute_code: "color" which exists as a custom attribute but that gave me the following error in postman: "Field "color" is not defined by type ProductAttributeFilterInput."

here is my query: `{ products(filter: {

 color: { eq: "4677" } }) {
total_count
items {
  name
  sku
  price
}

} }`

I'm using magento 2.3.4

error in postman

I would be grateful if someone could help me

1 Answers

As far as the error message I can understand that the color field is not declared in the ProductAttributeFilterInput. Please check the schema.graphqls file again and make sure the fields you want are declared properly

Related