Some Metafields do not have Metafield Definitions

I noticed that some metafields don’t seem to be associated with any Metafield Definition in the API, so we have no information on these metafields (information like the number of products they are used in metafieldsCount)

Question

  1. how can Metafields exist without a Metafield Definition
  2. How can we access information on how the metafields are used similar to the Metafiel Definitions

Hi @Dev_Siena,

It’s possible to create metafields through the API that don’t have a metafield definition. (This was originally the only way to do it, before Shopify added metafield definitions to try and add some structure to the chaos.)

You can view these ‘unstructured’ metafields for an object by:

  1. In the Shopify admin go to Settings → Custom data
  2. Click on the object you want (eg, Products)
  3. You’ll see a page like ‘Product metafield definitions’, at the top click on View unstructured metafields

This will show you a list of all the metafields for that object that don’t have a definition:

From there you can create a definition for them if you feel it’s needed.

On the API side, I don’t think there’s a public GraphQL API that can give you this data. The only way to find them would be to loop through all the metafields (maybe with a bulk export) and see which ones don’t have definitions associated with them.

Best,
Daniel