Storefront API products search results by translated values (translate & adapt app)

Storefront API products search results by translated values (translate & adapt app)

tomnightingale
Shopify Partner
1 0 0

Hi,

 

We have a store set up with 3 different markets. We're using the Translate and Adapt app to localize content into two additional languages (French & Spanish).

 

We're able to successfully query products across different markets (and return results in different languages) using the `@inContext` query directive. An example of the query is below:

 

query GetProductsByMarket(
  $query: String
  $countryCode: CountryCode!
  $language: LanguageCode!
) @inContext(country: $countryCode, language: $language) {
  products(first: 10, query: $query) {
    edges {
      node {
        id
        title
        handle
      }
    }
  }
}

However, when we also pass a `query` param, the results only show when using a 'query' matching products in the default store language.

 

Example product title translations:

EN Product name: English Mock Product

ES Product name: Spanish Mock Product

FR Product name: French Mock Product

 

Querying products with a term of 'Spanish' should return the product with the translated 'Spanish' product title.

I get 0 results from the API.

I get 0 results from the API for searching for 'French' too.

However, if I search for English, Mock, or Product I get the product returned from the API correctly.

It would appear that the query is only searching products in their default language, and not the translations.

 

Is there a way I can query the translated values and return the product via the API?

 

Thanks in advance,

Replies 0 (0)