I am using Magento 2 Graphql to get product collection based on category id.
I want to apply filter by color, size, material etc.
I have checked the graphql available filters and those are not mentioned as input.
I am executing below query.
{
products(
filter:{category_id: {eq: "23"}, material: {eq: "cotton"}}
currentPage: 1
pageSize: 5
){
items{
name
}
total_count
}
}
I have checked following file.
vendor/magento/module-catalog-graph-ql/etc/schema.graphqls
input ProductFilterInput @doc(description: "ProductFilterInput defines the filters to be used in the search. A filter contains at least one attribute, a comparison operator, and the value that is being searched for.") {
name: FilterTypeInput @doc(description: "The product name. Customers use this name to identify the product.")
sku: FilterTypeInput @doc(description: "A number or code assigned to a product to identify the product, options, price, and manufacturer")
description: FilterTypeInput @doc(description: "Detailed information about the product. The value can include simple HTML tags.")
short_description: FilterTypeInput @doc(description: "A short description of the product. Its use depends on the theme.")
price: FilterTypeInput @doc(description: "The price of an item")
special_price: FilterTypeInput @doc(description: "The discounted price of the product. Do not include the currency code.")
special_from_date: FilterTypeInput @doc(description: "The beginning date that a product has a special price")
special_to_date: FilterTypeInput @doc(description: "The end date that a product has a special price")
weight: FilterTypeInput @doc(description: "The weight of the item, in units defined by the store")
manufacturer: FilterTypeInput @doc(description: "A number representing the product's manufacturer")
meta_title: FilterTypeInput @doc(description: "A string that is displayed in the title bar and tab of the browser and in search results lists")
meta_keyword: FilterTypeInput @doc(description: "A comma-separated list of keywords that are visible only to search engines")
meta_description: FilterTypeInput @doc(description: "A brief overview of the product for search results listings, maximum 255 characters")
image: FilterTypeInput @doc(description: "The relative path to the main image on the product page")
small_image: FilterTypeInput @doc(description: "The relative path to the small image, which is used on catalog pages")
thumbnail: FilterTypeInput @doc(description: "The relative path to the product's thumbnail image")
tier_price: FilterTypeInput @doc(description: "The price when tier pricing is in effect and the items purchased threshold has been reached")
news_from_date: FilterTypeInput @doc(description: "The beginning date for new product listings, and determines if the product is featured as a new product")
news_to_date: FilterTypeInput @doc(description: "The end date for new product listings")
custom_layout_update: FilterTypeInput @doc(description: "XML code that is applied as a layout update to the product page")
min_price: FilterTypeInput @doc(description:"The numeric minimal price of the product. Do not include the currency code.")
max_price: FilterTypeInput @doc(description:"The numeric maximal price of the product. Do not include the currency code.")
category_id: FilterTypeInput @doc(description: "Category ID the product belongs to")
options_container: FilterTypeInput @doc(description: "If the product has multiple options, determines where they appear on the product page")
required_options: FilterTypeInput @doc(description: "Indicates whether the product has required options")
has_options: FilterTypeInput @doc(description: "Indicates whether additional attributes have been created for the product")
image_label: FilterTypeInput @doc(description: "The label assigned to a product image")
small_image_label: FilterTypeInput @doc(description: "The label assigned to a product's small image")
thumbnail_label: FilterTypeInput @doc(description: "The label assigned to a product's thumbnail image")
created_at: FilterTypeInput @doc(description: "Timestamp indicating when the product was created")
updated_at: FilterTypeInput @doc(description: "Timestamp indicating when the product was updated")
country_of_manufacture: FilterTypeInput @doc(description: "The product's country of origin")
custom_layout: FilterTypeInput @doc(description: "The name of a custom layout")
gift_message_available: FilterTypeInput @doc(description: "Indicates whether a gift message is available")
or: ProductFilterInput @doc(description: "The keyword required to perform a logical OR comparison")
}
Here i am not able to see color, size, material etc. I added them using a custom extension but still, filtering with them, gives me 0 results.
Anyone having any idea about it ?