Skip Navigation

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.

Sun Mon Tue Wed Thu Fri Sat
- - 9:00 – 18:00 9:00 – 18:00 9:00 – 18:00 9:00 – 18:00 9:00 – 18:00
- - - - - - -

Supporter timezone: America/Lima (GMT-05:00)

Tagged: 

This topic contains 17 replies, has 4 voices.

Last updated by Andreas W. 1 year, 2 months ago.

Assisted by: Andreas W..

Author Posts
July 19, 2022 at 1:56 pm #11694031

plants-are-friends-kftT

Hi there,

It seems like I have an issue with multicurrency, like the link below
https://wpml.org/errata/woocommerce-multilingual-multi-currency-displays-the-wrong-amount/
Can you please send me the code from this link (not jpg format), to use with copy paste?
Thank you!
Best regards,
Plante webmaster (Norbert)

July 19, 2022 at 2:12 pm #11694211

Marcel
Supporter

Languages: English (English ) German (Deutsch )

Timezone: Europe/Madrid (GMT+01:00)

Hi,

Norbert,

Sure!

Here is the workaround:

		$debug = new \WPML\Utils\DebugBackTrace();
		if ( $debug->is_class_function_in_call_stack( 'WPML_TM_ATE_Jobs', 'apply', true ) ) {
			return $price;
		}

Best Regards
Marcel

July 19, 2022 at 2:13 pm #11694259

Mihai Apetrei
Supporter

Languages: English (English )

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

Hi there.

Sure! Here is the code from that page:


$debug = new \WPML\Utils\DebugBackTrace();
		if ( $debug->is_class_function_in_call_stack( 'WPML_TM_ATE_Jobs', 'apply', true ) ) {
			return $price;
		}

Kind regards,
Mihai Apetrei

July 20, 2022 at 9:00 am #11698827

plants-are-friends-kftT

Hi,

Unfortunately it didn't work.
In the file I found the mentioned line on 149 - after I added the code, but the EUR prices on our site still not right. (plantebudapest.com)
I deleted before wpml plugins and downloaded from here the latest versions, activated them before I aded the code.
So can you help us please ?
Thank you!
Best regards,
Norbert
Plante webmaster

July 20, 2022 at 9:08 am #11698867

Marcel
Supporter

Languages: English (English ) German (Deutsch )

Timezone: Europe/Madrid (GMT+01:00)

Hi Norbert,

can you please explain which issue you exat have with the multi currency? If the workaround from that link doesn't solve it for you, then your site probably doesn't have the same issue.

Could you please provide more details about the exact issue so that I can check it?

Thank You!

Best Regards
Marcel

July 20, 2022 at 10:36 am #11699669

plants-are-friends-kftT

Of course!
Our site plantebudapest.com has 2 currency (HUF, EUR). Default is HUF, and we set manually EUR prices for the products. Multicurrency setting is by site language, and the issue is that the English version of the site doesn't show the right EUR prices, what we set for the products.
Example:
hidden link
HUF: 8800
EUR: 24 (on the site frontend)
but we set 30 manually for the EUR price.
Not all of the products has this issue...
Is it enough information for you to investigate?
Thank you!
Norbert

July 20, 2022 at 3:50 pm #11703011

Marcel
Supporter

Languages: English (English ) German (Deutsch )

Timezone: Europe/Madrid (GMT+01:00)

Hi Norbert,

yes, thank you! I would like to request temporary access (wp-admin and FTP) to your site to take a better look at the issue. It would be better to a testing site where the issue is replicated.

You will find the needed fields for this below the comment area when you log in to leave your next reply. The information you will enter is private which means only you and I can see and have access to it.

Maybe I'll need to replicate your site locally. For this, I’ll need to temporarily install a plugin called “Duplicator” or "All in One WP Migration" on your site. This will allow me to create a copy of your site and your content. Once the problem is resolved I will delete the local site. Let me know if this is ok with you.

IMPORTANT
-Please make a backup of site files and database before providing us access.
-If you do not see the wp-admin/FTP fields this means your post & website login details will be made PUBLIC. DO NOT post your website details unless you see the required wp-admin/FTP fields. If you do not, please ask me to enable the private box. The private box looks like this:
hidden link

Best Regards
Marcel

August 4, 2022 at 5:26 am #11799405

Andreas W.
Supporter

Languages: English (English ) German (Deutsch )

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

Hello Norbert,

Before I create a copy of your website to test this problem there more closely, I ask you to update all plugins and test again.

There are currently 21 plugin updates available here, many of them for WooCommerce addons.

If the issues persist after the updates, we're more than happy to take further steps.

Please always make a backup copy of the website and database before updating.

In addition, please deactivate those plugins that are in fact currently not needed on the website and test again.

For example, I see that "Product Category Discount" is active but not used.

The LocoTranslate plugin should also be disabled as it is not recommended to use more than one plugin of the same kind at the same time.

Kind regards
Andreas

August 4, 2022 at 1:35 pm #11804135

plants-are-friends-kftT

Hello Andreas,

I updated plugins, but 4 of them I could't yet - please continue to solve our issue like this, with duplicator. Woo Discount and Loco translate also disabled, but please don't delete, the Woo discount plugin will be used later.
Thank you, waiting for your answer and help!
Best regards,
Norbert

August 5, 2022 at 7:42 am #11808891

Andreas W.
Supporter

Languages: English (English ) German (Deutsch )

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

Hi Norbert,

Ok, I have taken a copy of your site and installed it on localhost for further testing.

I will get back to you with the results as soon as possible.

Best regards
Andreas

August 5, 2022 at 5:23 pm #11812251

Andreas W.
Supporter

Languages: English (English ) German (Deutsch )

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

Hello,

I took a copy of your site and could no longer see the issue.

Also on your live site, the example product shows now $30,00.

Could it be that the recommended updates already solved this issue?

Best regards
Andreas

example.png
August 8, 2022 at 12:48 pm #11823105

plants-are-friends-kftT

Hello Andreas,

Thank you.
I checked a few more products, for example: hidden link on the live site 49EUR, on the backend 62EUR, so it's not fiixed yet.
Can you help us please?
Best regards,
Norbert

August 9, 2022 at 4:31 pm #11834209

Andreas W.
Supporter

Languages: English (English ) German (Deutsch )

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

Hello Norbert,

In fact, now I see the same issue with your example on the local copy in minimal setup.

Please try adding the following snippet to your theme's functions.php file and test if this solves the issue:

/**
 * Force applying the translation with the default currency.
 *
 * @see <em><u>hidden link</u></em>
 */
add_filter( 'wpml_pre_save_pro_translation', function( $postArr ) {
	$multicurrency = \WPML\Container\make( \WCML_Multi_Currency::class );

	if ( $multicurrency ) {
		$multicurrency->set_client_currency( wcml_get_woocommerce_currency_option() );
	}

	return $postArr;
} );

Please also verify if this solves the issue after updating the original product and applying the translation again and let me know the results.

Best regards
Andreas

August 11, 2022 at 9:23 am #11848715

plants-are-friends-kftT

Hello Andreas

Unfortunately your code didn't solve the problem - photos attached for checking that.
2nd half I don't understand, please help me with that what I need to do exactly.
"updating the original product and applying the translation again"

Thank you!
Best Regards,
Norbert

Képernyőfotó 2022-08-11 - 10.27.47.png
Képernyőfotó 2022-08-11 - 10.26.06.png
August 11, 2022 at 2:34 pm #11851249

Andreas W.
Supporter

Languages: English (English ) German (Deutsch )

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

Hello,

I purged the SG Cache and the correct price is showing up now.

Take note that our team is still working on a solution for this issue, which should be available in one of the upcoming updates for our WooCommerce Multilingual & Multi-Currency Plugin.

Until now I am not able to confirm which version will be the one that will include a fix, so in case the issue occurs again after updating the WCML plugin for the next time, you might need to apply the workaround from our errata again.

Best regards
Andreas

cache purged.png

The topic ‘[Closed] Code request’ is closed to new replies.