Skip Navigation

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

Problem:
The client needed to access translated product attributes in WPML and was attempting to modify the code to get attributes in a specific language ('ru' for Russian), but the applied changes were not working.

Solution:
1. We informed the client that custom coding is beyond our support scope and directed them to our support policy for clarification.
2. We provided links to our hooks reference, which could help in finding the necessary information to solve the problem:

3. We requested the client's Debug information to better understand the site configuration.
4. We provided a code snippet that retrieves the translated value and label of product attributes, which works based on the page's language. The code is available on Pastebin: https://pastebin.com/0HqyaRqw.

If this solution does not apply to your case, or if it seems outdated, we recommend opening a new support ticket. We also highly recommend 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 visit our support forum: 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.

Tagged: 

This topic contains 18 replies, has 2 voices.

Last updated by Osama Mersal 1 year, 3 months ago.

Assisted by: Osama Mersal.

Author Posts
February 21, 2024 at 2:42 pm #15328803

christopherW-28

Hi

it seems to work, though we also added:

$my_current_lang = apply_filters( 'wpml_current_language', NULL );
do_action( 'wpml_switch_language', 'ru' );

to the top of the code, I cant see any other changes (overwritten again?), what did you do?

February 21, 2024 at 2:55 pm #15328868

Osama Mersal
WPML Supporter since 02/2020

Languages: English (English ) Arabic (العربية )

Timezone: Africa/Cairo (GMT+03:00)

Hi,

Please check the attached screenshot to see the changes.

Best regards,

2024-02-21_16-54-11.jpg
February 21, 2024 at 3:27 pm #15329093

christopherW-28

Hi thanks - the edit you made doesn't work in the original language, but using the wpml_switch_language does.

Thanks for all your help! We got there together.

Amazing support.

February 21, 2024 at 3:59 pm #15329295

Osama Mersal
WPML Supporter since 02/2020

Languages: English (English ) Arabic (العربية )

Timezone: Africa/Cairo (GMT+03:00)

Hi,

It's great to hear that the issue is fixed 🙂 . Please don't hesitate to open a new ticket if you face any other issues. We are always happy to help you.

Have a great day!

Best regards,

February 21, 2024 at 4:15 pm #15329340

christopherW-28

Great support!!