Skip to content

How to filter GraphQL product query for product type?

I have to filter the Magento 2 GraphQL query to filter based on the product type.

products(
            filter: {category_id: {eq: "3"}},
            sort: {name: ASC},
            pageSize: 2,
            currentPage: 1
        ) {
            total_count
            items {
                __typename
                name
                sku
                description {
                    html
                }
                short_description {
                    html
                }
                image {
                    url
                    label
                    position
                    disabled
                }
                small_image {
                    url
                    label
                    position
                    disabled
                }
                thumbnail {
                    url
                    label
                    position
                    disabled
                }
                price_range {
                    minimum_price {
                        regular_price {
                            value
                            currency
                        }
                        final_price {
                            value
                            currency
                        }
                        discount {
                            amount_off
                            percent_off
                        }
                    }
                    maximum_price {
                        regular_price {
                            value
                            currency
                        }
                        final_price {
                            value
                            currency
                        }
                        discount {
                            amount_off
                            percent_off
                        }
                    }
                }
            }
        }

In this query I am filtering using the category but I want it to filter the product by type.
eg – I only want to fetch the downloadable products.

Thanks in advance.