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

How to get translated product title in Shopify Flow?

How to get translated product title in Shopify Flow?

Toni_A
Shopify Partner
6 0 0

Hello!

 

I would like to know if it is possible to get the translated product title somehow in Flow.

 

I have used Get product data and for each I would like to do query to get the translated product title but I'm not sure if that is possible. Is there any other way?

 

Thanks in advance!

 

This is the query I have used to get the translated product title. (Cleared the id and locale.)

 

{
  product(id: "") {
    translations(locale: "") {
      value
    }
  }
}

Replies 19 (19)

Toni_A
Shopify Partner
6 0 0

Can't use translations as a variable, I tried also this but didn't work as shown in the screenshot.

 

get_product_data.png

DaveMcV
Shopify Staff
104 31 31

Hi @Toni_A,

 

The translations on a product are a list of Translation objects. Here are some Translation object docs on the structure of the data in that list.

 

You'll need to use some Liquid to get the translation you want using strategies outlined in the Liquid variables in Shopify Flow docs.

 

An example to get the translation for the key foo and locale en could be something like:

 

{%- assign translation = getProductForEachItem.translations | where: "key", "foo" | where: "locale", "en" | first -%}
{{translation.value}}

 



Hope that helps!

DaveMcV | Flow Development Manager @ Shopify
- Finding Flow useful? Leave us a review
- Need Flow help? Check out our help docs.
- Building for Flow? Check out Flow's dev docs.
Toni_A
Shopify Partner
6 0 0

Thanks so much for your help and reply.

 

Unfortunately still it says: "'translations' is invalid. Replace this variable."

For some reason it doesn't have access to the translations, am I right? Any ideas?

 

I changed your "getProductForEachItem.translations" to this: "getProductDataForeachitem.translations" because it said it was invalid and should replace the variable.

 

Näyttökuva 2024-3-29 kello 14.56.58.png

Toni_A
Shopify Partner
6 0 0

Hi DaveMcV,

 

Sorry to bother but did you have time to check my previous message about your reply?

 

Thanks in advance!

DaveMcV
Shopify Staff
104 31 31

Hi @Toni_A ,

 

We looked into it and found a problem with those fields and how Flow is able to access them. It's on the product team's radar to look at so stay tuned!

 

 

DaveMcV | Flow Development Manager @ Shopify
- Finding Flow useful? Leave us a review
- Need Flow help? Check out our help docs.
- Building for Flow? Check out Flow's dev docs.
Toni_A
Shopify Partner
6 0 0

Hi Dave,

 

Thank you so much for the help. I will stay tuned, hopefully there will be a fix or solution to this. Thanks!

 

Best,

Toni

Toni_A
Shopify Partner
6 0 0

Hi Dave,

 

Sorry to bother again with this. Any news? I'm stuck with my issue because I would really need a translated title to be used in flows. Thanks!

paul_n
Shopify Staff
1828 199 435

We have a feature in the works to be able to access fields that require arguments (like translations and metafields), but are focused on metafields currently. We can't offer a timeline at the moment for when translations will be available. 

Paul_N | Flow Product Manager @ Shopify
- Finding Flow useful? Leave us a review
- Need Flow help? Check out our help docs.
- Building for Flow? Check out Flow's dev docs.
Makeit
Shopify Partner
15 0 0

Cheers @paul_n , yeah I know you in April '24 couldn't offer a timeline for when translations will be available, do you have anything more concrete at this time? 

Being able to work with translations in Flow would def be a game changer for us dealing with multiple languages.

 

paul_n
Shopify Staff
1828 199 435

Not yet. At the moment we are focused on fields required for Flow to adopt new API versions. 

Paul_N | Flow Product Manager @ Shopify
- Finding Flow useful? Leave us a review
- Need Flow help? Check out our help docs.
- Building for Flow? Check out Flow's dev docs.
bassel-shahin
Shopify Partner
2 0 3

Hello @paul_n, Is there any update regarding this ?

misterBoy
Visitor
2 0 0

and now? Do you have an update for us?

Makeit
Shopify Partner
15 0 0

Moving closer to 1yr since no news about accessing translations with Flows.

You got anything to share?

 

paul_n
Shopify Staff
1828 199 435

There is a workaround in that you can now use Send HTTP request to directly call the API and get the translations. You'll need to generate an API key to make the call. Which API depends on which translations. 

 

Regarding an easier to use option, we are still working to get Flow on the latest API version, which needs to finish before we take us this work. It is going faster, but I don't have an ETA on when this will be done.

Paul_N | Flow Product Manager @ Shopify
- Finding Flow useful? Leave us a review
- Need Flow help? Check out our help docs.
- Building for Flow? Check out Flow's dev docs.
Makeit
Shopify Partner
15 0 0

Thanks @paul_n for the suggested workaround. I can see that as a viable temporary solution to ease som of the automation work for translation - while waiting for a more handy solution via Flow. I'll make some tests.

Nick_D
Shopify Partner
2 0 0

Any more info on this? I am running into the same problem now.

For the workaround how is that supposed to work? It seems like the REST api can't access the translation data and the graphQL api can't be used in Flow, so I would need to have another server running somewhere just to proxy the request to access the product translations?

Makeit
Shopify Partner
15 0 0

Just like Paul suggested:

 

  • Generate an API key to make the call. (Which API depends on which translations)
  • Use the flow action called Send HTTP request
bassel-shahin
Shopify Partner
2 0 3

You can use send http request action as suggested and then call the admin graphQL api from the flow

basselshahin_0-1750748225229.png

and most probably afterwards you will need to add a `run custom code` action to parse the response so you are able to get the content for me I only wanted to get the translation digest

basselshahin_1-1750748363965.png

 

paul_n
Shopify Staff
1828 199 435

Nice, here's an example if you are trying to get translations on a single resource like a product, as well as other details:

{
"query": "query ProductCollection($collectionID:ID!, $productID: ID!, $locale: String!) { product(id: $productID) { id\n inCollection(id: $collectionID)\n frTranslations:translations(locale:$locale) { key\n value } } }",
 "variables": {
    "productID": "{{ product.id }}",
    "collectionID": "gid://shopify/Collection/626830573590", 
    "locale": "fr"  
  }
}
Paul_N | Flow Product Manager @ Shopify
- Finding Flow useful? Leave us a review
- Need Flow help? Check out our help docs.
- Building for Flow? Check out Flow's dev docs.