Metafields with api

Metafields with api

aliveli
Visitor
2 0 0

Hello,

 

I’m working on adding metafields to products using the REST API. I’ve successfully sent requests to create the metafields, but when I check the product on the website, the metafields do not appear because they are not configured. Currently, I am configuring them manually through the Shopify admin panel.

 

Is there a way to fully automate the configuration of metafields via the API, so that they appear correctly on the product page without manual intervention?

 

Thank you for your assistance!

Replies 2 (2)

Liam
Community Manager
3108 341 881

Hi Aliveli,

 

You should be able to set values for metafields with either a put request with REST (see docs and examples here) or with the GraphQL API using the metafieldsSet mutation

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

aliveli
Visitor
2 0 0

Hi Liam,

First of all, thank you for your response.

 

Yes I am able to modify an existing configured metafield via api. But when I want to create a new metafield using api, it is not configured and I should configure it manually using shopify admin website.