When you translate a product metafield then the metafield entry data is not received by the cart transform function in the context of the current market or language. Shopify returns always the content of the primary market. While localized content is expected.
For example in our situation we have the Netherlands as the primary market and Swiss a secondary market. For Swiss we would like to receive localized metadata to manipulate the price in a different way then for the primary market. But we only receive the metafield data of the primary market.
We tested with the following query:
query Input {
presentmentCurrencyRate
localization {
language {
isoCode
}
country {
isoCode
}
market {
handle
regions {
name
}
}
}
cart {
lines {
quantity
cost {
amountPerQuantity {
amount
}
}
merchandise {
... on ProductVariant {
id
product {
bulk: metafield(namespace: "bulk", key: "prices") {
value
}
}
}
}
}
}
}
Result for the Netherlands:
{
"presentmentCurrencyRate": "0.94505346",
"localization": {
"language": {
"isoCode": "NL"
},
"country": {
"isoCode": "NL"
},
"market": {
"handle": "netherlands",
"regions": [
{
"name": "Netherlands"
}
]
}
},
"cart": {
"lines": [
{
"quantity": 25,
"cost": {
"amountPerQuantity": {
"amount": "35.0"
}
},
"merchandise": {
"id": "gid://shopify/ProductVariant/49623544693052",
"product": {
"bulk": {
"value": "10:32,50;25:30.50;50:28;75:26"
}
}
}
}
]
}
}
Result for Swiss:
{
"presentmentCurrencyRate": "0.94505346",
"localization": {
"language": {
"isoCode": "DE"
},
"country": {
"isoCode": "CH"
},
"market": {
"handle": "switserland",
"regions": [
{
"name": "Switzerland"
}
]
}
},
"cart": {
"lines": [
{
"quantity": 25,
"cost": {
"amountPerQuantity": {
"amount": "33.0"
}
},
"merchandise": {
"id": "gid://shopify/ProductVariant/49623544693052",
"product": {
"bulk": {
"value": "10:32,50;25:30.50;50:28;75:26"
}
}
}
}
]
}
}
Example of the translated metafield:
Expected output in this case: Swiss translation: 10:30;25:27,50;75:24
Note the i’ve read the Localization practices for Shopify Functions documentation and be aware that the amountPerQuantity
is localized and that we can use presentmentCurrencyRate
. But it would be nice to have the metafield data in the context of the current market/country so we can manipulate the price, product titles or messages in a unique way for each market.