Conversations about creating, managing, and using metafields to store and retrieve custom data for apps and themes.
Hello,
the API documentation for the PHP programming language is horrible. It's hard to understand anything.
I need to migrate a lot of data from OXID Shop System to Shopify. 🙈
Actually, I am trying to create some metafields for collections. We want to display a text for search engines on the collection page below, under the pagination.
In the first step, I just want to create/define some meta fields and then assign the values for each collection in a for-each loop.
This is the documentation:
https://shopify.dev/docs/api/admin-rest/2024-01/resources/metafield#post-blogs-blog-id-metafields
The title is "Create meta fields".
It's not clear what they mean by "create".
Create an assignment -> assign / set a value to an object
or
Create a definition -> create a new meta field with name and description to assign/set the values later?
Or does this call automatically check if the definition already exists and create it if not.
It is extremely wired. Why do I have the option to specify a description as a parameter that is never used, and why can't I specify a name?
I have uploaded 2 screenshots:
Solved! Go to the solution
This is an accepted solution.
Hi - It may actually be easier to use the GraphQL API rather than the REST API for this, with the metafieldDefinitionCreate mutation. There's an example of what this could look like in our developer docs.
Liam | Developer Advocate @ Shopify
- Was my reply helpful? Click Like to let me know!
- Was your question answered? Mark it as an Accepted Solution
- To learn more visit Shopify.dev or the Shopify Web Design and Development Blog
This is an accepted solution.
Hi - It may actually be easier to use the GraphQL API rather than the REST API for this, with the metafieldDefinitionCreate mutation. There's an example of what this could look like in our developer docs.
Liam | Developer Advocate @ Shopify
- Was my reply helpful? Click Like to let me know!
- Was your question answered? Mark it as an Accepted Solution
- To learn more visit Shopify.dev or the Shopify Web Design and Development Blog