Discuss and resolve questions on Liquid, JavaScript, themes, sales channels, and site speed enhancements.
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-filterab...
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.
Solved! Go to the solution
This is an accepted solution.
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).
To learn more visit the Shopify Help Center or the Community Blog.
This is an accepted solution.
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).
To learn more visit the Shopify Help Center or the Community Blog.
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-filterab... docs too. Thanks!
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.
To learn more visit the Shopify Help Center or the Community Blog.
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!
- Tom
Hey Community! As the holiday season unfolds, we want to extend heartfelt thanks to a...
By JasonH Dec 6, 2024Dropshipping, a high-growth, $226 billion-dollar industry, remains a highly dynamic bus...
By JasonH Nov 27, 2024Hey Community! It’s time to share some appreciation and celebrate what we have accomplis...
By JasonH Nov 14, 2024