We have a Shopify app that our customers use to manage products on their store. The app queries their metafieldDefinitions. The problem is, for this one customer, the query does not return all of their definitions. The query looks like this:
query GetShopifyMetadataDefinitions {
productMetafieldDefinitions:metafieldDefinitions(first: 250, ownerType: PRODUCT) {
nodes {
name
key
namespace
type {
name
category
}
}
}
}
Our client has 58PRODUCT metafield definitions, but this query returns only 17. There is no pattern to the definitions returned that I can see:
Its not the most recent or the first 17
they can have any namespace
they can have any type.name or type.category
some currently have values and some do not
some are in categories and some are not
some have Storefront API access checked and some do not
any combination of the other options checked
I suspect it might be some kind of permission issue somewhere but I don’t know where. As far as I know, for apps, you either get all the metafields or you don’t.
Is it something user specific? I was invited to their store and created my own definition but I couldn’t get it in the query either.
From which app/token are you running this query (your own app, the Dev Dash app, the GraphiQL app, etc.)?
The Admin API only returns metafield definitions that are visible to the app whose access token you’re using. For a given token, metafieldDefinitions will show:
merchant‑owned metafield definitions
standard metafield definitions
Any app‑owned metafield definitions that belong to that specific app (its own $app namespace)
It won’t show app‑owned metafield definitions that belong to other apps, even though you can see those in the Shopify Admin UI.
Any chance the “missing” metafields were created/configured by another app installed on the store?
- hey folks. Just +1ing what @curzey said - this is the most likely reason why you wouldn’t be able to see all metafields. Sharing some docs on this in case it’s helpful for reference:
In our case the problem ended up being we were connecting to the customer’s staging store instead of their production store, which only had a subset of the data we needed . The cause was human error. Everything on Shopify’s side works as expected once we connected to the correct store.