Taxonomy from GraphQL Returned Only in English

daniel-lee92
Tourist
4 0 2

Hello experts,

 

I've tried to retrieve all product category from store and found taxonomy is used for product category in Shopify.

And then, I succeeded to retrieve all taxonomy list in store with GraphQL according to below docs.

 

https://shopify.dev/docs/api/admin-graphql/2023-01/objects/ProductCategory

 

However, the data returned are only in English even though the default language of store is set in another language.

 

For sure, other data extracted are the same with store's default language.

I do not know why product category(taxonomy) returned in English and how to change the language.

 

Will be appreciate for any idea.

Thanks.

Reply 1 (1)

simonhaenisch
Shopify Partner
16 1 35

Exact same problem... a bit sad that there isn't even a reply 😕

 

My best idea now is to download (and probably cache by day to not get rate-limited) the full list, e.g. https://help.shopify.com/txt/product_taxonomy/de.txt (replace country code with the one you need), then 🤞 that the IDs actually map one-to-one (looks like it from a first glance), and parse the categories out of it.

 

Example: the graphql query gives me ID "gid://shopify/ProductTaxonomyNode/174", so I look up the line starting with 174 and then do a regex like `/^\d+ - (.+)$/` to capture the group name. Could split by " > " to get the segments but I don't need that.

 

I'll probably also strip the first line and then turn it into an array by splitting the whole thing by newline character. That way I can access the localized category just by using the ID as an index 🤓