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)