translatableResourcesByIds bug in 2024-04

Hi,

This works in 2023-10 and 2024-01, but not in 2024-04:

query {
  translatableResourcesByIds(first: 10, resourceIds: ["gid://shopify/ProductVariant/20995642"]) {
    edges {
      node {
        resourceId
        translatableContent {
          key
          value
          digest
          locale
        }
      }
    }
  }
}

There is no mention of any change in 2024-04.

It says invalid id. If changing to Product instead of ProductVariant it does not give any error. But we need to get translations of product variant.

This breaks our app.

Please help!

Hi DavidDB1,

As of API v2024-04 ProductVariant is no longer a TranslateableResourceType, you’ll need to look up the product option value id’s instead
On the doc for the TranslateableResourceType Enum, if you change to v2024-01 there’s this deprecation warning on the PRODUCT_VARIANT type:

To get the ID’s you need, you could use a translatableResources query filtering for a resourceType of PRODUCT_OPTION_VALUE. These changes are related to the new product API changes for increased variants.

Hope this helps!

Hi Liam,

Thanks for this info.

If I understand this correctly, in our case this will make the translation resource totally useless.

Scenario: Our app print out x packing slips. Let’s say 100. Each with 2 different products.

So either we have to call translatableResources to get all product variants in the store, which could be in the tens of thousand. Or 200 times translatableResource to get option values for all the products.

Each of these is practically impossible regarding time spent and query costs.

Today we collect all the products/variants on these orders, and run mostly one query to get all translations

Something like this:

{
translatableResourcesByIds(first: 10, resourceIds: "list of product and variant ids") {
edges {
node {
resourceId
 translations(locale: "en") 
{
key
value
locale
}
}
}
}
}

So how should we solve this?