Skip Navigation

This thread is resolved. Here is a description of the problem and solution.

Problem:
The client is experiencing an issue where the product ID changes when switching languages from Italian to English in a WPML-translated e-commerce platform. This change in ID causes issues with the platform's ability to recognize the correct product.
Solution:
We explained that each translation in WPML is treated as new content, hence each has a unique ID. To maintain consistency across languages, you can use the

wpml_object_id

hook to fetch the correct translated content's ID. This ensures that each language displays the appropriate content without changing the original product ID in all languages. For more details on how to implement this, please visit the documentation on WPML Object ID Hook.

If this solution does not apply to your case, or if it seems outdated, we recommend opening a new support ticket. We also highly suggest checking related known issues at https://wpml.org/known-issues/, verifying the version of the permanent fix, and confirming that you have installed the latest versions of themes and plugins. For further assistance, please contact our support team at WPML Support Forum.

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 3 replies, has 2 voices.

Last updated by Andreas W. 11 months, 3 weeks ago.

Assisted by: Andreas W..

Author Posts
June 8, 2024 at 11:20 am #15718260

marcoB-117

Hello, i faced an issue with wpml translators: the product id change when i change language from italian to english, and this cause issue with my platform that recognizes the italian id.

Can you help me please to fix this issue?

Thank you, Marco

June 9, 2024 at 3:58 am #15718750

Andreas W.
WPML Supporter since 12/2018

Languages: English (English ) Spanish (Español ) German (Deutsch )

Timezone: America/Lima (GMT-05:00)

Hello,

This is expected, as each translation is handled like new content and has its proper ID.

You can get the translated content's ID by using this hook:
https://wpml.org/wpml-hook/wpml_object_id/

Best regards
Andreas

June 9, 2024 at 4:50 am #15718786

marcoB-117

Hello Andreas, thank you for your response, saw the page https://wpml.org/wpml-hook/wpml_object_id/, and i see some examples how to change a singular id or if the translation missing, so i'm little bit confused.

So such my situation is the follow: I've some products in my shop already translated, from Italian to English with different id for each language.

So now i would maintain the same product id for each language.

Can you pass me a code as can i do it, or could you please suggest an apposite page?

Thank you Marco

June 11, 2024 at 1:26 pm #15726889

Andreas W.
WPML Supporter since 12/2018

Languages: English (English ) Spanish (Español ) German (Deutsch )

Timezone: America/Lima (GMT-05:00)

Translated products have a proper ID, and the provided hook will make sure that each language will display the language-specific content.

If the ID does not change, then you will display the original product in all languages.

June 12, 2024 at 1:03 pm #15731740

marcoB-117

Good support