Metafields API

Metafields API

sahilrev
Shopify Partner
22 0 1

I am trying to create Metafield from API and able to do it for a specific product or collection.

 

But the issue I am facing is how to create a metafield that can get pin and have definition in it from API? Because all the metafield that I am creating from POSTMAN doesn't get pin and it always goes into metafield without Definition?

 

Is there a way I can create a global metafield from Postman that have definition in it and that will get pin automatically, so that we can use it on all the products. 

Replies 4 (4)

Liam
Shopify Staff
2873 312 821

Hi Sahilrev,

 

You can use the metafieldDefinitionCreate mutation to add definitions to metafields and then you can use the metafieldDefinitionPin mutation to pin it on the admin. Hope this helps!

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

sahilrev
Shopify Partner
22 0 1

Hello @Liam I have gone through the documentation that you have shared and it can be possible through GraphQL API, Is it possible to attain the same from Rest API's?

abhishek2309
Shopify Partner
1 0 0

Hi @sahilrev have you managed to create Metafield with definition through rest API. I also want to do the same. 

Also @Liam if you can help me with the same.

Thanks

Amad_Riaz
Shopify Partner
4 0 0

This video will help you how to create metafields with definition and without definition Shopify App Metafields