Re: 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 15 (15)

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
1817 199 432

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
14 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
1817 199 432

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
1 0 2

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
14 0 0

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

You got anything to share?

 

paul_n
Shopify Staff
1817 199 432

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
14 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.