Fetching also translations with Storefront API Graphql Endpoint

Solved
ptrck_schndr
Tourist
6 0 1

We are using the Storefront API to fetch more than 50 products at once on the Products QueryRoot Object with an array of IDs. This runs very smooth and fast, so no problem here. We have also translated product data with the Admin Translation API by a self-made custom app which fetches products from an ERP automatically. Runs smooth too, so there is also no problem here.

BUT – if we use the i18n language codes to switch the translations in the URL, e.g. from https://supershop.com to https://supershop.com/fr and then using the /api/graphl endpoint, it still gives us the standard language data from the product and NOT the translated french language data.

Is there any possibility that the endpoint recognizes that I am doing my request from a translated shop url?

0 Likes
c10s
Shopify Partner
15 2 3

This is an accepted solution.

Try adding an Accept-Language header to the request, as documented here: https://shopify.dev/tutorials/support-multiple-languages-with-storefront-api#retrieving-storefront-a...

0 Likes
ptrck_schndr
Tourist
6 0 1

Thanks, this did the trick!