Generatate Translations for Metafields via API

Hi there fellas,

so what I´m trying to achieve in the long run is importing english translations to the product metafields of a german plus store (from a csv).

My first step was to write a little Python script that lists the metafield and their content for each product and also displays their translations, given a specific product handle. And what shall I say…even this little test fails :wink:

Query looks like this:

def get_metafield_translation(metafield_id, locale):
    query = """
    query getMetafieldTranslation($id: ID!, $locale: String!) {
      metafield(id: $id) {
        translations(locale: $locale) {
          key
          value
          locale
        }
      }
    }
    """
    result = shopify_graphql(query, {"id": metafield_id, "locale": locale})
    return result.get("data", {}).get("metafield", {}).get("translations", [])

I manage to display the source content but the translation always seems to return (null), even if they contain content in the Translate & Adapt App. Those metafields are unstructured, is that part of the problem? Or do i have to change my approach?

Cheers

Chris