my site is natively lang='nl', and also has language lang='fr'
base language inquiry:
on several products, such like hidden link
should return only 1 set of json data, but returns a multitude of completely identical json product data with the same productid (50657).
though hidden link
only returns that data once (with the productid, no language parameter).
foreign language inquiry 'fr' :
probably same issue but inverse result. I have products that exist in lang=fr hidden link
returns []
but they exist in the backend. When i inspect them, i find out that the productid is 50777
and indeed though hidden link
gives me the data.
so, it appears that in some ways, the indexes are broken, or there is a bug in the way WPML handles the ../wc/v3/products api with the 'lang' parameter.
The data seems OK as the productid only exists once in both cases
How can i proceed to have the ../wc/v3/products?sku=...&lang=.. work correctly ?
We use WPML 4.6.10
Thank you for reaching out to WPML support. While you're waiting for one of my colleagues to handle this ticket, let me offer you some initial debugging steps to assist with the issue promptly.
I make a quick test on my localhost and see the request to the WooCommerce REST API with language parameter returns a correct result. Only the product in the request language is displayed. Here is the screen record hidden link
I suggest you enable a minimal environment as below and see if it helps:
- Deactivate all non-WPML plugins.
- Switch to a standard theme of WordPress.
- Ensure the SKU value is unique for the product and the same for its translation.
❌ IMPORTANT: Please backup your database and website before proceeding ❌
Either Woocommerce or WPML or derived plugins were not in sync (version). After fully updating all plugins, the REST API replies correctly.
Thank you for your support.
Olivier