A space to discuss GraphQL queries, mutations, troubleshooting, throttling, and best practices.
Using the Translations API docs the only translatable field for the type PRODUCT_OPTION
is name.
There is no option to set translations for the option's values.
When using a query such as this:
query ($productId: ID!, $locale: String! ) {
product(id: $productId) {
id
handle
title
status
onlineStoreUrl
totalInventory
hasOnlyDefaultVariant
translations(locale: $locale) {
key
value
}
options(first: 3) {
name
values
translations(locale: $locale) {
key
value
}
}
}
}
results in:
"data": {
"product": {
"id": "gid://shopify/Product/...",
"handle": "...",
"title": "...",
"status": "ACTIVE",
"onlineStoreUrl": "...",
"totalInventory": 187,
"hasOnlyDefaultVariant": false,
"translations": [
{
"key": "body_html",
"value": "<p>C'est une Apple produit.</p>"
},
{
"key": "title",
"value": "Apple Cinematic 30\""
}
],
"options": [
{
"name": "An Option",
"values": [
"Large",
"Medium",
"Small"
],
"translations": [
{
"key": "name",
"value": "Translated Option"
}
]
},
{
"name": "Another Option",
"values": [
"Yellow",
"Green",
"Blue",
"Red"
],
"translations": [
{
"key": "name",
"value": "ANother translated option"
}
]
},
{
"name": "And again",
"values": [
"Checkbox 4",
"Checkbox 3",
"Checkbox 2",
"Checkbox 1"
],
"translations": [
{
"key": "name",
"value": "And again translated"
}
]
}
]
}
}
The values themselves are not translated and there is no possibility to use this query to display the possible option values in any language other than the default (non-translated) language.
The PRODUCT_VARIANT translatable resource does allow translations of each variants value for product options named option1, option2, option3 but I don't understand how this is helpful:
Anyone work around this somehow? IMO, Makes the Admin API unusable for presenting product option values in a multi-language setting.
I have the same problem.
Did you manage to translate a specific product options names/values using GraphQL?
I cannot find any way to translate those resources
Also running into this issue right now. End up finding a solution?
Hi!
here is my post, which explain how I did it:
How to translate product variants options "name" and "value" using GraphQL?
https://community.shopify.com/c/graphql-basics-and/how-to-translate-product-variants-options-quot-na...
Actually, I managed to translate the product option "name" (ex: "color") and I thought I would translate the product option "values" the same way, but it does not work. I can't find any way to translate the option values (in ex. "red", "green" etc.).
If I use the ProductVariant object to translate this option value, it does not work.
When I query the Product object I can get the options values, but then those values are not within the TranslatableResource query…
I found this object but it's only in the unstable API version: https://shopify.dev/docs/api/admin-graphql/unstable/objects/ProductOptionValue
Did you find a way to translate product options values?
Yeah I did it by grabbing the translatable content on the variant. That gives you a digest you can use to edit them.
Hi Kalen
Yes, I thought I would do the same, but the weird thing is: Whet I get the translatable resource from the productVariant, I get the necessary data (key, hash digest, etc.) but when I translate those data, it just duplicates the translations.
As a result, on my product page, My product variants options are duplicated (which is weird) and it completely mess up my product page in other languages.
You don't have this problem on your side?
Maybe I have this problem because several of my products variants have the same options value, in exemple {Red, S}, {Red, M}, {Red, L}, etc. It does translate each of those "Red" and as a result, those are duplicated in the "Shopify Translate & Adapt" app, and on the product page on the front-end side.
In my opinion, Product->Options->values should be the translated element, but Shopify does not allow it, as this is in the query but not in the translatable resources.
I actually haven't looked at the frontend yet - I'm only working on populating the backend. Also the products I've tested with only have one option on them it seems (size). I agree the option values themselves should be the translated element.