Conversations about creating, managing, and using metafields to store and retrieve custom data for apps and themes.
Hi!
I have a store with functionalities heavily reliant on products custom metafields. For a non-technical person, creating a product like that would be super difficult to fill out properly, so I want to create a base in airtable from where all correct information would be filled and then passed to shopify with an API call.
The problem is when metafields values are empty I cannot get their IDs. Using a method like 'Retrieve a list of metafields by using query parameters' returns an empty array. Similarly, i cannot get the metfields ids when I try to get them one by one. I saw on this forum that is a problem for other people as well, but found no answer...
Hacky way might be creating a default value for every metafield, then i could retrieve the IDs and override the values, but I do not know if that's possible.
Has someone overcome this?
Solved! Go to the solution
This is an accepted solution.
For anyone looking, the proper way to go about this is to use the Create Metafield method.
An empty metafield wouldn't exist as it needs _some_ value to create one.
If you've pulled all metafields on a product you'd know what ones exist though, and the values each contains.
Hi, thanks for responding. I've understood I have used inaccurate names to describe my problem. What I meant is I have metafield definitions in place and I want to populate those definitions but don't know how to grab the definitions to put my data.
This is an accepted solution.
For anyone looking, the proper way to go about this is to use the Create Metafield method.