Can't add translation for descriptionHtml

I am trying to add translations to products using translationsRegister mutation. So far I can successfully add translation for the title field, but when I try to add translation for the descriptionHtml (that is using as translation key “descriptionHtml”) I get an error that the field is not available as translatable resource. I also tried to use “body_html” as key, but in that case i got an invalid hash error (of course I used a hash value based on descriptionHtml). So how can I add translation for descriptionHtml? Thanks

To add translations for descriptionHtml using the translationsRegister mutation, ensure your mutation uses the correct field and structure:

Mutation Example:

mutation {

translationsRegister(

translations: [

{

resourceId: “gid://shopify/Product/PRODUCT_ID”

resourceType: PRODUCT

locale: “LANGUAGE_CODE”

translations: [

{ key: “title”, value: “Translated Title” },

{ key: “descriptionHtml”, value: “

Translated HTML Description

” }

]

}

]

) {

userErrors {

field

message

}

}

}

Use descriptionHtml for product descriptions.

Ensure the resourceType is PRODUCT and t

he HTML content is valid.

Hi. I am afraid this is not working…
And according to the documentation the structure of the translationsRegister is

mutation translationsRegister($resourceId: ID!, $translations: [TranslationInput!]!) {
  translationsRegister(resourceId: $resourceId, translations: $translations) {
    userErrors {
      message
      field
    }
    translations {
      key
      value
    }
  }
}

There is no resourceType field and the locale field is inside each translationInput entity

You can make use of Langify

1 Like