[BUG] translatableResource key for Metafields is always "value"

I am pretty sure the intention of the key return was not that it’s always “value” rather than the metafield id.

Can some Dev please look into it? There is no way to distinguish the Fields right now.

query TranslatableResource {
  translatableResource(resourceId: "gid://shopify/Product/123") {
		nestedTranslatableResources(resourceType:METAFIELD, first: 10) {
      edges {
        node {
          translatableContent {
            key
            type
            digest
            locale
          }
        }
      }
    }
  }
}

Result

{
  "data": {
    "translatableResource": {
      "nestedTranslatableResources": {
        "edges": [
          {
            "node": {
              "translatableContent": [
                {
                  "key": "value",
                  "type": "STRING",
                  "digest": "4f49f8116c5f34929fbce70d2717446f13568c68d0cf58422abb471172e6ecd2",
                  "locale": "en"
                }
              ]
            }
          },
          {
            "node": {
              "translatableContent": [
                {
                  "key": "value",
                  "type": "STRING",
                  "digest": "5b06c1f5381779ad3c90f4657cee27e6538942c9af0e562c9220c82095741832",
                  "locale": "en"
                }
              ]
            }
          },
          {
            "node": {
              "translatableContent": [
                {
                  "key": "value",
                  "type": "SINGLE_LINE_TEXT_FIELD",
                  "digest": "504657d178145c8b13a17dbac8d4316a8fce74dc054103db3db4da79578b59f9",
                  "locale": "en"
                }
              ]
            }
          }
        ]
      }
    }
  },
  "extensions": {
    "cost": {
      "requestedQueryCost": 7,
      "actualQueryCost": 7,
      "throttleStatus": {
        "maximumAvailable": 2000,
        "currentlyAvailable": 1993,
        "restoreRate": 100
      }
    }
  }
}




1 Like

Hey @Buttjer,

The key field in translatableContent represents “the resource field that’s being translated” rather than the metafield identifier itself.

For metafields, the only translatable part is the value field, so key: "value" is correct behavior.

To distinguish between different metafields, you’ll want to use the resourceId field in your query:

query TranslatableMetafields {
  translatableResource(resourceId: "gid://shopify/Product/YOUR_PRODUCT_ID") {
    nestedTranslatableResources(resourceType: METAFIELD, first: 10) {
      edges {
        node {
          resourceId
          translatableContent {
            key
            type
            digest
            locale
            value
          }
        }
      }
    }
  }
}

Returns:

{
  "data": {
    "translatableResource": {
      "nestedTranslatableResources": {
        "edges": [
          {
            "node": {
              "resourceId": "gid://shopify/Metafield/147816938962966",
              "translatableContent": [
                {
                  "key": "value",
                  "type": "STRING",
                  "digest": "c2ca16d048ec017f9d85b3dac8803ae2",
                  "locale": "en",
                  "value": "false"
                }
              ]...