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

Last updated by patrickW-37 2 weeks, 2 days ago.

Assigned support staff: Alejandro.

Author Posts
September 10, 2019 at 8:57 pm #4548877

patrickW-37

Hi, thanks for fixing my last problem with WooCommerce Multilingual. I found another problem this time connected with official WooCommerce Product Add-ons plugin.

WPML tries to 'translate' (try to change currency) of custom values even if field is percentage type.

For example - we can set 20% discount field then WPML changes this value as simple currency for example USD to EUR. Then we don't have 20% any more just 18.11%.

I think percentage values should not be edited. It would be nice if you could prepare for me testing env so I can set all plugins so you can fix that problem.

Thanks

September 11, 2019 at 9:05 am #4551911

Alejandro
Supporter

Languages: English (English ) Spanish (Español ) Italian (Italiano )

Timezone: Europe/Rome (GMT+02:00)

Hello!
Welcome to WPML Support.
I'll do my best to help you solve this issue.

Could you upload that plugin in this sandbox: hidden link

Then, replicate the problem over there and lastly tell me how to do so, so i can take a look and determine if we're talking about a compatibility issue (it sounds like it).

Thanks in advance.

September 11, 2019 at 6:13 pm #4555885

patrickW-37

Hi, I uploaded WooCommerce Product Add-ons plugin but I wasn't able to update WPML CMS Multilang. plugin so WooCommerce Multilingual was not working (undefined error when after clicking update button). I deleted these outdated plugins and tried to install my, up-to-date wpml plugins but upload speed to your testing env. is very very slow...

So - could you install newst versions of your WPML plugins on the testing env so I can finish replicating my problem?

September 12, 2019 at 6:01 am #4558537

Alejandro
Supporter

Languages: English (English ) Spanish (Español ) Italian (Italiano )

Timezone: Europe/Rome (GMT+02:00)

Try now, please.

September 13, 2019 at 7:32 pm #4570511

patrickW-37

hidden link

Ok, so as you can see. Value1 (-20%) is constant, percentage value and it shouldn't be changed when user switches currency to EUR from PLN.

But now - if you try to change currency then -20% is changed to 4.62%.

Other fields with lets say 'int' values are converted correctly.

September 16, 2019 at 8:30 am #4577407

Alejandro
Supporter

Languages: English (English ) Spanish (Español ) Italian (Italiano )

Timezone: Europe/Rome (GMT+02:00)

Hello, i just wanted to let you know that the problem seems to be a bug, i ran a lot of tests and the result didn't change.

I asked one of our developers to take a look at it and i'm waiting on his feedback.

I'll let you know once i have it.

September 16, 2019 at 8:41 am #4577485

patrickW-37

Thank you very much for your support 😉

I am waiting for your reply

September 16, 2019 at 1:33 pm #4580809

Alejandro
Supporter

Languages: English (English ) Spanish (Español ) Italian (Italiano )

Timezone: Europe/Rome (GMT+02:00)

As i thought, It's actually the first time we hear about this issue and there weren't any other related issues about WooCommerce Add-ons either so you definitely spotted a bug.

Our Compatibility team has checked out the issue and they are now working to find a solution to the problem.

I'll update you as soon as i have more information.

Regards.

September 26, 2019 at 3:03 pm #4648177

Alejandro
Supporter

Languages: English (English ) Spanish (Español ) Italian (Italiano )

Timezone: Europe/Rome (GMT+02:00)

Hello,

We found a workaround while we work on a permanent fix.

Go to wp-content/plugins/woocommerce-multilingual/compatibility/class-wcml-product-addons.php and change the foreach loop from:

				foreach ( $addon['options'] as $key => $option ) {
					if (
						$is_custom_prices_on &&
						isset( $option[ 'price_' . $client_currency ] ) &&
						$option[ 'price_' . $client_currency ]
					) {
						$addons[ $add_id ]['options'][ $key ]['price'] = $option[ 'price_' . $client_currency ];
					} else {
						$addons[ $add_id ]['options'][ $key ]['price'] = apply_filters( 'wcml_raw_price_amount', $option['price'] );
					}
				}

to:

				foreach ( $addon['options'] as $key => $option ) {
					if (
						$is_custom_prices_on &&
						isset( $option[ 'price_' . $client_currency ] ) &&
						$option[ 'price_' . $client_currency ]
					) {
						$addons[ $add_id ]['options'][ $key ]['price'] = $option[ 'price_' . $client_currency ];
					} else {
						if ($option["price_type"] !== "percentage_based" ){
						$addons[ $add_id ]['options'][ $key ]['price'] = apply_filters( 'wcml_raw_price_amount', $option['price'] );
							}
					}
				}

Try it out and let me know how it goes.

Regards.

September 29, 2019 at 11:37 am #4660647

patrickW-37

Thanks for your support. Modified code works fine, I think now it should be added in the next update 😉