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 8 (8)

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
87 26 24

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
87 26 24

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
1010 133 240

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.