Skip to content Skip to sidebar

This is the technical support forum for WPML - the multilingual WordPress plugin.

Everyone can read, but only WPML clients can post here. WPML team is replying on the forum 6 days per week, 22 hours per day.

Sun Mon Tue Wed Thu Fri Sat
- 8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 -
- 12:00 – 16:00 12:00 – 16:00 12:00 – 16:00 12:00 – 16:00 12:00 – 16:00 -

Supporter timezone: Europe/Zagreb (GMT+02:00)

This topic contains 2 replies, has 2 voices.

Last updated by Dražen 1 year, 1 month ago.

Assisted by: Dražen.

Author Posts
September 10, 2024 at 11:13 am #16160752

Joel Rocha

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?

September 10, 2024 at 1:27 pm #16161790

Joel Rocha

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.

September 13, 2024 at 6:04 am #16173941

Dražen
Supporter

Languages: English (English )

Timezone: Europe/Zagreb (GMT+02:00)

Hello,

I created a minimal installation of WordPress, WPML, and all necessary WPML add-ons, and themes.

You can access the WordPress dashboard using the link below:

- hidden link

Try to replicate the issue with a simple example page.

This will help us to report the probable issue to the compatibility team and solve the possible problem faster.

Regards,

Drazen

The topic ‘[Closed] Translated WooCommerce products variations not showing in graphql queries’ is closed to new replies.