I’m attempting to use the new Admin filterable metafield capability as outlined here: https://shopify.dev/docs/apps/build/custom-data/metafields/use-metafield-capabilities#admin-filterable
However, the API returns this error for all of my attempts:
The capability admin_filterable is not valid for this definition.
Here is an example mutation:
mutation metafieldDefinitionUpdate($definition: MetafieldDefinitionUpdateInput!) {
metafieldDefinitionUpdate(definition: $definition) {
userErrors {
field
message
}
updatedDefinition {
key
name
namespace
ownerType
id
useAsCollectionCondition
capabilities {
adminFilterable {
enabled
}
}
}
}
}
And here are the variables"
{
"definition": {
"namespace": "custom",
"key": "material",
"name": "material",
"ownerType": "PRODUCT",
"capabilities": {
"adminFilterable": {
"enabled": true
}
}
}
}
And this is the response:
{
"data": {
"metafieldDefinitionUpdate": {
"userErrors": [
{
"field": [
"definition"
],
"message": "The capability admin_filterable is not valid for this definition."
}
],
"updatedDefinition": null
}
},
Also note the example in the linked dev doc has two typos that would not work on the 2024-10 API. “adminFilterStatus” is not supported in the response params, and “type” is not allowed in metafield definition updates.
What definition type do you have? The admin filterable capability is only supported by a few of the types right now.
As an aside: we’ll get this list into the dev docs so it’s easier to find (and fixup those errors in the example mutation).
Ah that must be it. I was using “number_integer”. Any chance that is on the roadmap for the near future? My use case is to store product sales rank info. Might be a good idea to list the restriction about types on the https://shopify.dev/docs/api/admin-graphql/2024-10/mutations/metafieldDefinitionUpdate and https://shopify.dev/docs/apps/build/custom-data/metafields/use-metafield-capabilities#admin-filterable docs too. Thanks!
1 Like
We’ll expand the types supported — just timing and priorities 
We’ll add the supported types to the capabilities page; feels like the natural home to me.
Excellent, thanks Jesse! I can appreciate needing to time and prioritize things
I hope to see number_integer in the near future, ideally with support for less than and great than options in addition to the current checkbox “is equal” version.
Also, fyi the smartCollectionCondition works great, but one thing that seems off is the condition is not applied until you save and reload or come back into the collection. Perhaps that is already on your radar, but wanted to mention it in case you were not aware.
And lastly, one capability that’d be super powerful is the ability to use a metafield value for custom sorting, in case you don’t have that on your list yet.
Thanks again!
1 Like
Yes, please expand the types available for the filtering.
Also, a bit of off-topic but:
It would be great to understand which fields can be used natively (https://shopify.dev/docs/api/usage/search-syntax)
title, created_at, orders_count, first_name, where can I check which fields are available?
I am getting the same error on the admin UI interface when trying to make an existing metafield filterable
“Single line text” is supported metafield type as per the docs. Am I missing something?