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
9:00 – 18:00 9:00 – 18:00 9:00 – 18:00 9:00 – 18:00 9:00 – 18:00 - -
- - - - - - -

Supporter timezone: Africa/Cairo (GMT+03:00)

This topic contains 2 replies, has 1 voice.

Last updated by Osama Mersal 3 months, 1 week ago.

Assisted by: Osama Mersal.

Author Posts
April 11, 2025 at 5:46 pm #16924055

ingridS

Background of the issue:
I’m trying to fetch WooCommerce products in a specific language (e.g., Spanish or Italian) using WPGraphQL and WPML GraphQL. I want to filter products by language in the products query (e.g., products(where: {language: "es"})), but I get an error. This filter works for the posts query but not for products. As a workaround, I tried using the translations field to fetch translations and filter on the client side, but this resulted in an error because I was using an older version of WPGraphQL WooCommerce. I’ve updated to the latest versions of WPGraphQL and WPGraphQL WooCommerce.

Symptoms:
Error message: "Field 'language' is not defined by type 'RootQueryToProductUnionConnectionWhereArgs'" and "Internal server error" ("Call to undefined method WPGraphQLModelPost::get_type()").

Questions:
Is there a way to directly filter products by language in the products query without client-side filtering?

April 11, 2025 at 5:49 pm #16924059

ingridS

I’m trying to fetch WooCommerce products in a specific language (e.g., Spanish or Italian) using WPGraphQL and WPML GraphQL. I want to filter products by language in the products query (e.g., products(where: {language: "es"})), but I get an error. This filter works for the posts query but not for products. As a workaround, I tried using the translations field to fetch translations and filter on the client side, but this resulted in an error because I was using an older version of WPGraphQL WooCommerce. I’ve updated to the latest versions of WPGraphQL and WPGraphQL WooCommerce.

April 15, 2025 at 11:09 am #16933666

Osama Mersal
WPML Supporter since 02/2020

Languages: English (English ) Arabic (العربية )

Timezone: Africa/Cairo (GMT+03:00)

Hi,

Thanks for contacting WPML forums support. I'll be glad to help you today.

First of all, sorry for the late reply; it was due to a higher workload.

1) Please log in to this hidden link">sandbox site and replicate the issue. If the issue is replicable, please let me know so I can check it and consult our 2nd-tier support team.

2) Could you please share your Debug information with me?
You can read a detailed explanation about it here. (http://wpml.org/faq/provide-debug-information-faster-support)
The debug info will give me much information about how your site is configured.

Best regards,
Osama

The topic ‘[Closed] I’m trying to fetch WooCommerce products’ is closed to new replies.