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.

No supporters are available to work today on this forum. Feel free to create tickets and we will handle it as soon as we are online. Thank you for your understanding.

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

Supporter timezone: America/Los_Angeles (GMT-08:00)

This topic contains 18 replies, has 4 voices.

Last updated by Nicolas V. 1 month, 2 weeks ago.

Assisted by: Bobby.

Author Posts
May 20, 2024 at 12:16 pm #15645664

ponkula

I set up EUR currency for a payment gateway to recieve payment in EUR. Everything seems correct on checkout page. There is the message said the payment will be converted to EUR, but after checking out, the payment is still in THB.

wpml3.JPG
wpml2.JPG
wpml1.JPG
May 20, 2024 at 7:52 pm #15647326

Bobby
Supporter

Languages: English (English )

Timezone: America/Los_Angeles (GMT-08:00)

Hi there,

After the payment was processed did you receive the payment in EUR or THB in your bank account?

Based on the checkout process and the warning given payment should have been processed in EUR.

May 28, 2024 at 8:42 am #15676997

ponkula

I receive payment in THB.
I have also tried with PayPal and Stripe. Results are the same. It's not converted to EUR.
I tried disable all other plugin. It still doesn't work.

May 30, 2024 at 7:25 pm #15690007

Bobby
Supporter

Languages: English (English )

Timezone: America/Los_Angeles (GMT-08:00)

I would like to request temporary access (wp-admin and FTP) to your site to test the issue.
(preferably to a test site where the problem has been replicated if possible)

**Before we proceed It is necessary to take FULL BACKUP of your database and your website. Providing us with access, you agree that a backup has been taken **

I often use the Duplicator plugin for this purpose: http://wordpress.org/plugins/duplicator/
You will find the needed fields for this below the comment area when you log in to leave your next reply.
The information you enter is private which means only you and I have access to it.

NOTE: If access to the live site is not possible and the staging site does not exist please provide me with a duplicator package created with the duplicator plugin.

Thank you,
Bobby

June 3, 2024 at 10:44 pm #15699416

Bobby
Supporter

Languages: English (English )

Timezone: America/Los_Angeles (GMT-08:00)

Thank you for the access details!

I am reviewing this with our team and will update you as soon as I have some feedback.

June 5, 2024 at 5:34 pm #15708283

Bobby
Supporter

Languages: English (English )

Timezone: America/Los_Angeles (GMT-08:00)

We are still working on this and will update you the moment I have some feedback!

June 23, 2024 at 8:56 am #15793008

ponkula

Hi, do you have any update on this?

June 24, 2024 at 6:16 pm #15810377

Bobby
Supporter

Languages: English (English )

Timezone: America/Los_Angeles (GMT-08:00)

Hi there,

Our team has reviewed this issue, and based on their feedback, the general idea behind this feature is that most users set up their bank transfer payment gateways to match the target currency. For example:

EUR order => EUR bank account
USD order => USD bank account
We have prepared a workaround to help with this issue. Please add the following code to your theme's functions.php file:

function custom_woocommerce_order_get_total( $total, $order ) {
	remove_filter( 'woocommerce_order_get_total', 'custom_woocommerce_order_get_total', 10, 2 );
    global $woocommerce_wpml, $gateway;
    $gateway = $order->get_payment_method();
	$available_gateways = WC()->payment_gateways->get_available_payment_gateways();
	if ( isset( $available_gateways[ $gateway ] ) ) {
		$payment_gateway = $available_gateways[ $gateway ];
	}
    if ($gateway == 'bacs') {
	    $bacs     = new \WCML_Payment_Gateway_Bacs( $payment_gateway, $woocommerce_wpml );
	    $settings = $bacs->get_settings();
    }
    $currency = $order->get_order_currency();
	$exchange_rate = $woocommerce_wpml->settings["currency_options"][$currency];
    $in_default_currency = $total / $exchange_rate["rate"];
    if (isset($currency) && $currency != $settings[$currency]["currency"]) {
        //$ordertotal = $order->get_total('view');
	    $ajd_total = apply_filters('wcml_raw_price_amount', $in_default_currency, $settings[$currency]["currency"]);
      //  $order->set_total($ajd_total); //causes to update the order total - don't use
    }
	add_filter('woocommerce_order_get_currency', 'custom_order_currency', 10, 2);
//	add_filter( 'woocommerce_order_get_total', 'custom_woocommerce_order_get_total', 10, 2 );

    if ($ajd_total && $ajd_total != $total) {
	    return $ajd_total;
    } else {
        return $total;
    }
}
add_filter( 'woocommerce_order_get_total', 'custom_woocommerce_order_get_total', 10, 2 );


function custom_order_currency($currency, $order) {
	remove_filter('woocommerce_order_get_currency', 'custom_order_currency', 10, 2);
	global $woocommerce_wpml, $gateway;
	$gateway = $order->get_payment_method();
	$available_gateways = WC()->payment_gateways->get_available_payment_gateways();
	if ( isset( $available_gateways[ $gateway ] ) ) {
		$payment_gateway = $available_gateways[ $gateway ];
	}
	if ($gateway == 'bacs') {
		$bacs     = new \WCML_Payment_Gateway_Bacs( $payment_gateway, $woocommerce_wpml );
		$settings = $bacs->get_settings();
	}
	if (isset($currency) && $currency != $settings[$currency]["currency"]) {
		$currency = $settings[$currency]["currency"];
	}

	return $currency;
}

Before proceeding, please note that this is a custom workaround, and you should ensure you have a working backup in place.

NOTE: Always have a recent and working backup before making any changes recommended by our team or a third party.

June 28, 2024 at 10:28 am #15851075

ponkula

I have tested your code. It still doesn't work. The code just make currency on order page to be EUR, but on thank you page and on order detail page still show incorrect currency.
I also test with Paypal and stripe. It also charge in THB instead of EUR.

wpml-3.JPG
wpml-2.JPG
wpml-1.JPG
July 1, 2024 at 5:42 pm #15870074

Bobby
Supporter

Languages: English (English )

Timezone: America/Los_Angeles (GMT-08:00)

Hi there,

After discussing this with our team I was advised that this feature will for BACS will be altered in the coming versions and might possibly be removed due to the way the transfer to the bank works.

A reason behind this it's because

"The client will send a transfer in YY currency, even if the bank account is natively in XX currency. When the bank receives the payment it will automatically make the conversion to XX (the conversion fee will be charged to the seller generally)."

The workaround provided will partially fix the issue, but yes the order details will still display the default currency.

Also, for PayPal - I can see that there are no credentials for PayPal for the second currencies.

Which would probably cause a fallback to the original values in that case.

July 2, 2024 at 4:40 pm #15877156

ponkula

Thank you for the explanation about BACS issue. I will wait for the next versions.
For PayPal, I have add all credentials and set like this : EUR order => choose PayPal => receive payment in THB. But the problem still persists. It charges in EUR instead of THB.

wpml2-3.JPG
wpml2-2.JPG
wpml2-1.JPG
July 2, 2024 at 7:28 pm #15877847

Bobby
Supporter

Languages: English (English )

Timezone: America/Los_Angeles (GMT-08:00)

Hi there,

I was able to reproduce it.

The issue happens when you use the plugin WooCommerce PayPal Payments.

Our team is working on resolving a known issue with that plugin.
https://wpml.org/errata/woocommerce-paypal-payments-currency-code-is-not-currently-supported/

You can try to deactivate this plugin and use the PayPal Standard (a native feature of WooCommerce) and recheck this issue.

July 8, 2024 at 1:56 pm #15913741

ponkula

PayPal Standard is no longer avaliable for the newer version of woocommerce, so I try Stripe instead. I have added all stripe credentials but the problem is still the same. The currency is not converted to EUR. This time I set : THB order -> stripe -> receive payment in EUR.
I have to remove the workaround you've send before because it makes error when paying.

wpml3-3.JPG
wpml3-2.JPG
wpml3-1.JPG
July 8, 2024 at 5:26 pm #15914905

Bobby
Supporter

Languages: English (English )

Timezone: America/Los_Angeles (GMT-08:00)

Thank you for updating me, we are reviewing this

July 9, 2024 at 8:03 pm #15923038

Bobby
Supporter

Languages: English (English )

Timezone: America/Los_Angeles (GMT-08:00)

This has been escalated to our developers team, I will update you as soon as I have some feedback.