Storefront API Collection filtering by productType not working

Topic summary

Issue: A Storefront API GraphQL query to fetch products in collection “ag” filtered by productType = “Tee” (API version 2022-04) returned products with types “Denim” and “Short” instead of “Tee”, despite Tee products existing.

Finding: The problem was not the query itself but store configuration. Filtering by product type must be enabled in the admin for it to take effect in Storefront API collection queries.

Resolution: Enable allowed filters in the Shopify admin.

  • Path: Online Store > Navigation
  • Action: Scroll to the bottom and add the relevant allowed filters (including product type).

Current status: The original poster confirms enabling filters resolved the issue. Another participant asked for precise location/section of the setting, seeking clarification on where the filter was activated.

Open point: Clarification requested on the exact admin section for activating the filter (referenced as Online Store > Navigation, allowed filters at the bottom).

Summarized with AI on December 21. AI used: gpt-5.

We are facing some issues to get the expected results from the Shopify API. Here is an example query to get products for collection AG and productType = Tee, but the graphql query we are using is not returning us the expected result.
Here is the API reference that we followed, API_VERSION = ‘2022-04’

Below is the GraphQL query:

query MyQuery {
  collection(handle: "ag") {
    products(filters: {productType: "Tee"}, first: 2) {
      edges {
        node {
          id
          productType
        }
      }
    }
  }
}

Query result returned:

{
  "collection": {
    "products": {
      "edges": [
        {
          "node": {
            "id": "gid://shopify/Product/767547",
            "productType": "Denim"
          }
        },
        {
          "node": {
            "id": "gid://shopify/Product/7267",
            "productType": "Short"
          }
        }
      ]
    }
  }
}

See the returned products type is not “Tee”. But we have the products with this type in the store inventory.
Can someone please help with this? What is wrong with the query?

OK this turned out to be a configuration issue. To allow filtering by product type, it needs to be turned on in the admin for your store. If you navigate to: Online Store > Navigation

… and scroll to the bottom, you will see where you can add allowed filters:

Hello @alamincse07 , in which section did you say you activated this filter?