Conversations about creating, managing, and using metafields to store and retrieve custom data for apps and themes.
Hi,
I’m trying to add a new entry for the meta-object called product_relationship, I mean new data like a new product in the product object so the same for meta-object API,
I read this documentation
https://shopify.dev/docs/apps/custom-data/metaobjects/manage-metaobjects
I tried this request according to the guide:
mutation { metaobjectCreate(metaobject: { type: "$app:product_relationship", fields: [ { key: "group", value: "b" }, { key: "prodcut", value: "gid://shopify/prodcut/6931492569178" } ] }) { metaobject { id type group: field(key: "group") { value } prodcut: field(key: "prodcut") { value }, } } }
But I get this response:
{
"data": {
"metaobjectCreate": {
"metaobject": null
}
},
"extensions": {
"cost": {
"requestedQueryCost": 12,
"actualQueryCost": 10,
"throttleStatus": {
"maximumAvailable": 2000.0,
"currentlyAvailable": 1990,
"restoreRate": 100.0
}
}
}
}
Thanks!
Solved! Go to the solution
This is an accepted solution.
Hi Neryaelul,
This does sound strange - did running metaobjectDefinitionCreate before (like in step 1 here) work as expected?
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 Neryaelul,
This does sound strange - did running metaobjectDefinitionCreate before (like in step 1 here) work as expected?
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
The problem was that I couldn't add it because it seems that definition meta-objects created in the administration interface (admin) cannot be added to them in the API App.
Glad you figured out the problem!
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