Filtering Products on productType

products(first:20 query: “productType:calendar_sku”)

Returns:
[…]
“productType”: “grouped_plain”,
[…]

Is that an expected behavior?

Thank you.

I have tried a number of variations, but it looks like this query selection is not working.

Hi Jerome,

Can you post your full query (removing anything sensitive/ replacing with demo info)?

This format works for me, for getting products where type = “accessories”:

query GetAccessories {
  products(first: 10, query: "product_type:accessories") {
    edges {
      node {
        id
        title
        productType
        vendor
        createdAt
      }
    }
  }
}

returns:

{
  "data": {
    "products": {
      "edges": [
        {
          "node": {
            "id": "gid://shopify/Product/123456789",
            "title": "Selling Plans Ski Wax",
            "productType": "accessories",
            "vendor": "-----",
            "createdAt": "2025-01-10T10:29:09Z"
          }
        }
      ]
    }
  },
  "extensions": {
    "cost": {
      "requestedQueryCost": 6,
      "actualQueryCost": 3,
      "throttleStatus": {
        "maximumAvailable": 2000,
        "currentlyAvailable": 1993,
        "restoreRate": 100
      }
    },
    "search": [
      {
        "path": [
          "products"
        ],
        "query": "product_type:accessories",
        "parsed": {
          "field": "product_type",
          "match_all": "accessories"
        }
      }
    ]
  }
}

Thanks Liam.

this query:

query ProductCatalog_ByClass {
products(first: 200, query: “productType:calendar_sku and status:ACTIVE”) {
edges {
node {
id
title
status
productType
publishedAt
}
}
}
}

returns:
{
“data”: {
“products”: {
“edges”: [
{
“node”: {
“id”: “gid://shopify/Product/7739324334127”,
“title”: “12"L Hardwood Paint Stir Stick”,
“status”: “ACTIVE”,
“productType”: “grouped_plain”,
“publishedAt”: “2024-06-21T23:24:25Z”
}
},
{
“node”: {
“id”: “gid://shopify/Product/7739324727343”,
“title”: “21"L 5 Gallon Hardwood Paint Stir Stick”,
“status”: “ACTIVE”,
“productType”: “grouped_plain”,
“publishedAt”: “2024-06-21T23:24:40Z”
}

},

This one:
products(first: 200, query: “productType:calendar_sku”)

returns:

{
“data”: {
“products”: {
“edges”: [
{
“node”: {
“id”: “gid://shopify/Product/7558314524719”,
“title”: “Associated Fee”,
“status”: “ACTIVE”,
“productType”: “grouped_plain”,
“publishedAt”: “2024-04-17T16:42:44Z”
}
},
{
“node”: {
“id”: “gid://shopify/Product/7739279573039”,
“title”: “America The Beautiful - 2025 Promotional Calendar”,
“status”: “ARCHIVED”,
“productType”: “calendar_sku”,
“publishedAt”: null
}
},

I find this a bit baffling.

Thanks for your help.

The warnings:
“search”: [
{
“path”: [
“products”
],
“query”: “productType:calendar_sku”,
“parsed”: {
“field”: “productType”,
“match_all”: “calendar_sku”
},
“warnings”: [
{
“field”: “productType”,
“message”: “Invalid search field for this query.”
}

Is it that adding the additional condition status:ACTIVE is causing an issue?

Having checked the docs, you should be using product_type in your query, not productType, just note that the returned field may not always match the query format.

2 Likes

Thanks a lot. Never assume…

Luke, I suspect this is a legacy situation as the expectations of filtering by actual field name is more logical.

You help a lot.

Regards.

1 Like