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.

This topic contains 1 reply, has 2 voices.

Last updated by Long Nguyen 1 year, 2 months ago.

Author Posts
April 19, 2024 at 2:13 pm #15544218

olivierD-44

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

April 22, 2024 at 3:20 am #15547922

Long Nguyen
WPML Supporter since 02/2022

Languages: English (English )

Timezone: Asia/Ho_Chi_Minh (GMT+07:00)

Hi Olivier,

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 ❌

Looking forward to your reply.
Thanks

April 23, 2024 at 12:29 pm #15555872

olivierD-44

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