Our Partner & Developer boards on the community are moving to a brand new home: the .dev community forums! While you can still access past discussions here, for all your future app and storefront building questions, head over to the new forums.

We're moving the community! Starting July 7, the current community will be read-only for approx. 2 weeks. You can browse content, but posting will be temporarily unavailable. Learn more

Storefront API language and region responses inconsistency

Storefront API language and region responses inconsistency

chris__m
Shopify Partner
2 0 1

Hello,

 

I've met an issue during development of world-wide shop based on Storefront API 2022-01.

 

When I try to get translated Product response using header:

"Accept-Language": "de"

with given region using:

@inContext(country: DE)

I get correct price (in EURO), but fields from query (title, description etc.) aren't translated.

 

The only way to get fields translated from Storefront API is to remove the @inContext from query.

Am I doing something wrong? Is there a solution for that?

 

My sample query, tested with Storefront API 2022-01:

query @inContext(country: DE) {
node(id: "[PRODUCT_ID]") {
id
...on Product {
title
priceRange {
maxVariantPrice {
currencyCode
}
}
}
}

Response:

{
"data": {
"node": {
"id": "[PRODUCT_ID]",
"title": "[ENGLISH PRODUCT TITLE]",
"priceRange": {
"maxVariantPrice": {
"currencyCode": "EUR"
}
}
}
},
"extensions": {
"context": {
"country": "DE",
"language": "DE"
}
}
}

 

From what I can see there is a new @inContext parameter called "language" in 2022-04 version, so I can type:

@inContext(country: DE, language: DE)

But I still get response with English values:

{
"data": {
"node": {
"id": "[PRODUCT_ID]",
"title": "[ENGLISH PRODUCT TITLE]",
"priceRange": {
"maxVariantPrice": {
"currencyCode": "EUR"
}
}
}
},
"extensions": {
"context": {
"country": "DE",
"language": "EN"
}
}
}

 

Replies 0 (0)