Hello,
I’m able to get the products translation via GraphQL API but I can’t figure out how and if it’s possible to get translated metafields as well. More specifically I need to recover the variant metafields.
This is my current call with untranslated metafield
query getProduct {
product(id: "gid://shopify/Product/6550868590685") {
en: translations(locale: "en") {
key
locale
value
}
de: translations(locale: "de") {
key
locale
value
}
fr: translations(locale: "fr") {
key
locale
value
}
variants(first: 1) {
edges {
node {
metafield1: metafield(namespace: "custom", key: "main_color") {
value
}
}
}
}
}
}
Could someone help me?
Thanks so much
I still have the same problem, does anyone have a solution? I need a way to extract metafield translations via API, translations are entered via Translate & Adapt
Thanks
Also looking for help with this.
Hi @egiuliani & @Kalen_Jordan 
To query translatable resources for metafields, you can specify the resourceType to be METAFIELD, or query them by the metafield ID:
{
translatableResources(first: 3, resourceType: METAFIELD) {
nodes {
resourceId
translatableContent {
key
value
}
}
}
translatableResourcesByIds(first: 5, resourceIds: [
"gid://shopify/Metafield/123",
"gid://shopify/Metafield/456"
]) {
nodes {
resourceId
translatableContent {
key
value
}
}
}
}
For variant metafields, it would involve a 2 step process:
- fetch all the metafield IDs for the variants:
{
productVariants(first:5) {
nodes {
metafield(namespace:"custom", key:"main_color"){
id
}
}
}
}
- then use the returned metafields in the
translatableResourcesByIds query:
{
translatableResourcesByIds(first: 5, resourceIds: [
"gid://shopify/Metafield/123", ...
]) {
nodes {
resourceId
translatableContent {
key
value
}
}
}
}
Hope that helps!