Background of the issue:
I'm using next.js as frontend and WordPress as backend in my website. I synced all my products in different languages using the automatisms from WPML, everything seems fine in the wp-admin. The problem is that I'm trying to fetch the product info on product single page using graphql queries, since I'm not able to pass language as an argument in the product query I'm just getting the product by slug, I defined a different slug for each product translation. And so my query goes like this:
query Product {
product(id: "masamune-pt", idType: SLUG) {
name
databaseId
language {
code
}
... on VariableProduct {
id
name
variations {
edges {
node {
id
name
}
}
}
}
}
}
Symptoms:
In this query it is supposed to return the product variations that are already defined in the wp-admin but instead it returns empty. It returns variations if I query the original product in the default language but doesn't work for the translated duplicated ones. I can see that the variations exist on wp-admin, they were generated automatically when I synced the products.
Questions:
Why are the product variations not showing in the GraphQL query for translated products?
How can I fetch product variations for translated products using GraphQL?
I tried this with a fresh WP site with only the necessary plugins installed and updated. Tried to configure everything the same way, copied a test product from my website and translated the product to french. I executed the same GraphQL query for the translated product and the issue persists, no variations were returned.