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?
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.
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.