Skip Navigation

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

Problem:

YITH Global options do not show in the translated language

Solution:

The problem is that YITH WooCommerce Product is inserting the rule per product in wp_yith_wapo_blocks but only for the original one.

To fix that:

- Open .../wp-content/plugins/yith-woocommerce-product-add-ons/includes/class-yith-wapo-front.php
- Look for line 282.
- Change:

$included_product_check = in_array( (string) $product_id, (array) $block->get_rule( 'show_in_products' ), true );

- With:

if (class_exists('sitepress')) {
    $wpml_default_lang = apply_filters('wpml_default_language', NULL);
    $wpml_product_id = apply_filters('wpml_object_id', $product_id, 'product', FALSE, $wpml_default_lang);
    $included_product_check = in_array((string) $wpml_product_id, (array) $block->get_rule('show_in_products'), true);
} else {
    $included_product_check = in_array((string) $product_id, (array) $block->get_rule('show_in_products'), true);
}

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

Last updated by next-sasD 1 year, 10 months ago.

Assisted by: Christopher Amirian.

Author Posts
January 29, 2023 at 10:13 am

next-sasD

I have the YITh add-on plugin on my website. However, when I change language ( although all string of the plugin are translated) the options don't show on the products

January 29, 2023 at 11:30 am
January 29, 2023 at 12:04 pm #12912061

Christopher Amirian
Supporter

Languages: English (English )

Timezone: Asia/Yerevan (GMT+04:00)

Hi there,

I managed to finish installing WordPress, Woocommerce, WPML, and all WPML needed addons.

You can access the dashboard here:

hidden link

Please follow the steps below:

- Install the YITH Products Addons plugin
- Add a global option and assign it to one product (IU also imported some products that you can choose from)
- Translate the options (I added Italian and French like your installation)
- See if it shows correctly in Italian.

Get back to us with the result.

Thanks.

January 29, 2023 at 12:15 pm #12912075

next-sasD

Hi! Unfortunately it doesn't work here too. I have added the screenshots

Screenshot 2023-01-29 at 13.15.09.png
Screenshot 2023-01-29 at 13.15.00.png
January 30, 2023 at 8:07 am #12918937

Christopher Amirian
Supporter

Languages: English (English )

Timezone: Asia/Yerevan (GMT+04:00)

Hi there,

Thank you very much this shows that the issue is a compatibility between WPML and the YITH Wooco0mnmerce Products addon and Extra Options plugin.

I reported this to the compatibility team.

I will get back to you if I have an update from the compatibility team.

Thanks.

January 30, 2023 at 8:41 am #12919173

next-sasD

Hi, that's a real pity..

Do you have a timeline as to how long this might take? This issue is blocking my whole ecommerce.

January 30, 2023 at 3:06 pm #12922731

Christopher Amirian
Supporter

Languages: English (English )

Timezone: Asia/Yerevan (GMT+04:00)

Hi there,

There is no ETA at the moment that I can share with you.

I suggest for now trying to see if you can avoid using a global option in the plugin and instead add it inside the product itself on the product edit page. I am not sure if it is possible with the plugin or not.

Anyway, if I have an update I will share it with you here for sure.

Thank you.

February 1, 2023 at 12:04 pm #12937409

Christopher Amirian
Supporter

Languages: English (English )

Timezone: Asia/Yerevan (GMT+04:00)

Hi there,

The compatibility team came up with a workaround:

The problem is that YITH WooCommerce Product is inserting the rule per product in wp_yith_wapo_blocks but only for the original one.

To fix that:

- Open .../wp-content/plugins/yith-woocommerce-product-add-ons/includes/class-yith-wapo-front.php
- Look for line 282.
- Change:

					$included_product_check = in_array( (string) $product_id, (array) $block->get_rule( 'show_in_products' ), true );

- With:

					if (class_exists('sitepress')) {
						$wpml_default_lang = apply_filters('wpml_default_language', NULL);
						$wpml_product_id = apply_filters('wpml_object_id', $product_id, 'product', FALSE, $wpml_default_lang);
						$included_product_check = in_array((string) $wpml_product_id, (array) $block->get_rule('show_in_products'), true);
					} else {
						$included_product_check = in_array((string) $product_id, (array) $block->get_rule('show_in_products'), true);
					}

I tested the workaround above on the Sandbox and it worked ok.

I'd appreciate it if you can check yourself on your installation and get back to us with the result.

Thanks.