Update the metafield value for a product in a specific language using GraphQL

Update the metafield value for a product in a specific language using GraphQL

Asela123
Visitor
3 0 0

Hi,

I need to update a metafield value for a product in a specific language, such as English, using the API.

For example: I have a product and a metafield. I need to change the value of this product meta field for English or German using GraphQL. Could you guide me on how to do this?

Replies 3 (3)
Asela123
Visitor
3 0 0

product id is 8561755881811, metafield: bottom_description. i need to change German(de) value for this as "Veränderung testen". meta field type is 

rich-description

Eric-HAN
Shopify Partner
190 25 20

Hi ,there

 

you could refer to this  manual Manage translations of merchant-provided content

- Helpful? Please hit Like and mark it as a solution
Want to modify or custom changes on store? Let me help.
- Feel free to Email Me    Buy Me A Coffee

LucaRaveri
Shopify Partner
20 2 5

You should use the mutation translationsRegister:
https://shopify.dev/docs/api/admin-graphql/unstable/mutations/translationsregister

If you want to translate a metafield, the input variables looks like:

resourceId -> id of the metafield
translations -> [

locale -> the language ("it", "en" etc.)

key -> "value" (put this if you want to translate a metafield)
value -> your translation
translatableContentDigest -> hash of the original value (not translated value) of the metafield, calculated with sha-256 algorithm / you can retrieve this value with another API call i don't remember at the moment

]

Hope it can help!



If this was helpful, please Like it ⬆️
If this solved your problem, please Mark it as solution