grahpql productRecommendations returns the title and the desc of the main product

Koffein
Shopify Partner
5 1 1

Title.

 

The

 

productRecommendations(productId: "productId", intent: COMPLEMENTARY) {

graphql call returns correct information, except for the title and description of the complementary products.

 

The title and the description are instead of the main products, which is a bit weird.

 

Any ideas, solutions?

Replies 3 (3)

Liam
Shopify Staff
2731 301 779

HI Koffein,

 

If you're getting unexpected results when using the `productRecommendations` query in Shopify's GraphQL API, it could be due to a misinterpretation of the query structure. Specifically, you should ensure that you're structuring your query correctly to access the properties of the recommended products. Can you share the full query?

 

Hope this helps,

Liam | Developer Advocate @ Shopify 
 - Was my reply helpful? Click Like to let me know! 
 - Was your question answered? Mark it as an Accepted Solution
 - To learn more visit Shopify.dev or the Shopify Web Design and Development Blog

Koffein
Shopify Partner
5 1 1

Hey Liam,

 

While prepping to answer you, I found the problem 🦆

The localization of the mock products in our shop was not complete and I was getting the wrong data from the correct product, but only because someone put it there (or did not update the translations).

 

Thanks for the help anyway! 😬

Liam
Shopify Staff
2731 301 779

No worries! This is easy to happen - glad you figured it out!

Liam | Developer Advocate @ Shopify 
 - Was my reply helpful? Click Like to let me know! 
 - Was your question answered? Mark it as an Accepted Solution
 - To learn more visit Shopify.dev or the Shopify Web Design and Development Blog