-
-
Notifications
You must be signed in to change notification settings - Fork 143
Description
The latest version of wp-graphql-woocommerce appears to register its fields on Product and ProductVariation types in a way that prevents other plugins from extending these types. This causes a fatal DUPLICATE_FIELD error when a GraphQL translation plugin (like WPGraphQL WPML or WPGraphQL Polylang) is active, as they also try to add fields (e.g., language) to the same types.
The schema fails to build, making it impossible to query translated products.
Steps to Reproduce
Set up a WordPress environment with the latest versions of WPGraphQL, WooCommerce, wp-graphql-woocommerce, and any major translation suite (WPML + WooCommerce Multilingual + WPGraphQL WPML OR Polylang Pro + Polylang for WooCommerce + WPGraphQL Polylang).
Configure at least two languages.
The error occurs immediately upon schema generation. Trying to query for products with a language filter in the GraphiQL IDE fails.
Crucially, if you deactivate wp-graphql-woocommerce, the DUPLICATE_FIELD error disappears. The schema builds correctly (minus the products field, of course). This isolates the conflict to this plugin.
Expected behavior
wp-graphql-woocommerce should allow its types to be extended by other plugins, which is a standard requirement in the WordPress ecosystem.
Actual behavior
A DUPLICATE_FIELD error is thrown for fields like language, translation, id, price, etc., on the ProductVariation type, breaking the schema.
Error Log Snippet:
{
"type": "DUPLICATE_FIELD",
"message": "You cannot register duplicate fields on the same Type. The field 'language' already exists on the type 'ProductVariation'.",
"field_name": "language",
"type_name": "ProductVariation"
}
Environment
WordPress: Latest
WPGraphQL: Latest (v2.3.6)
WooCommerce: Latest
wp-graphql-woocommerce: Latest
Translation Suite: Happens with both WPML (latest) and Polylang Pro (latest) ecosystems.
This bug makes it impossible to build a headless, multilingual WooCommerce store with the current plugin versions. Please advise. Thank you.