Skip Navigation

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

Problem:
I want to show the related product section on the translation product page. This section is created by the plugin "Custom Related Products for WooCommerce".
Solution:
1. Go to WPML > Settings > Custom Fields Translation section > Click on "Show system fields" > Search for the field "_related_ids" > Set the preference to "Translate".
2. Add the code below to the file functions.php in the theme/child theme folder to translate the numeric value in Advanced Translation Editor (ATE).

function wpmlsupp_7499_allow_translating_numbers( $is_translatable, $job_translate ) {
    $data = $job_translate['field_data'];
    if ( 'base64' === $job_translate['field_format'] ) {
        $data = base64_decode( $data );
    }
    if ( is_numeric( $data ) ) {
        return true;
    }
    return $is_translatable;
}
add_filter( 'wpml_tm_job_field_is_translatable', 'wpmlsupp_7499_allow_translating_numbers', 10, 2 );

3. Edit the product in the original language > Click on Update > Update the translation in ATE.
4. Search for the related product ID number and translate it with the translation product ID. Please check the screenshot attached.
❌ IMPORTANT: Please backup your database and website before proceeding ❌
Relevant Documentation:
https://wpml.org/documentation/getting-started-guide/translating-custom-fields/

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

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

Assisted by: Long Nguyen.

Author Posts
November 29, 2023 at 8:26 am #14947025

benK-12

The custom related products section not translated

November 29, 2023 at 9:34 am #14948091

Long Nguyen
WPML Supporter since 02/2022

Languages: English (English )

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

Hi,

Here is the forum ticket. Please share your staging site credentials (wp-admin and FTP) so I can take a better look at the issue. Your next reply is set to private to share the info.
❌ IMPORTANT: Please backup your database and website before proceeding ❌

Look forward to your reply.
Thanks

November 30, 2023 at 2:27 am #14957181

Long Nguyen
WPML Supporter since 02/2022

Languages: English (English )

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

Hi,

I found a way to translate the related product section. Please follow steps below:

1. Go to WPML > Settings > Custom Fields Translation section > Click on "Show system fields" > Search for the field "_related_ids" > Set the preference to "Translate".

2. Add the code below to the file functions.php in the theme/child theme folder to translate the numeric value in Advanced Translation Editor (ATE).

function wpmlsupp_7499_allow_translating_numbers( $is_translatable, $job_translate ) {
    $data = $job_translate['field_data'];
	if ( 'base64' === $job_translate['field_format'] ) {
		$data = base64_decode( $data );
	}
    if ( is_numeric( $data ) ) {
    	return true;
    }
    return $is_translatable;
}
add_filter( 'wpml_tm_job_field_is_translatable', 'wpmlsupp_7499_allow_translating_numbers', 10, 2 );

3. Edit the product in Dutch > Click on Update > Update the translation in ATE.

4. Search for the related product ID number and translate it with the translation product ID. Please check the screenshot attached.
❌ IMPORTANT: Please backup your database and website before proceeding ❌

Look forward to your reply.
Thanks

Edit product “Linen curtain Classic Sand” ‹ Casa Comodo — WordPress 2023-11-30 09-23-52.png
Advanced Translation Editor - WPML 2023-11-30 09-18-05.png
November 30, 2023 at 9:25 am #14959985

benK-12

I tried the solution but it doesn't work. I translate with woocommerce Multilingual. But I want to leave it at that because the solution is far too complicated for us. I then have to go through all the products to get it right. I thought Woocommerce was compatible with WPML. Shame.
Thanks for your effort.

November 30, 2023 at 10:02 am #14960457

Long Nguyen
WPML Supporter since 02/2022

Languages: English (English )

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

Hi,

The section Related Products is added by a third-party plugin "Custom Related Products for WooCommerce", not WooCommerce itself.

This plugin is not available in our list of compatible plugins, which you can check here https://wpml.org/plugin/
I also suggest you contact the plugin author and ask them to join our Go Global program where our Compatibility developers will help them to make their product compatible with WPML.
https://wpml.org/documentation/support/go-global-program/

Thanks for your co-operation.