Skip Navigation

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

Problem: The function to get the exchange rate of a currency

Solution: WPML/WooCommerce Multilingual don't have a API/hook function for this purpose. But we can use following code for this purpose.

global $woocommerce_wpml;

echo $woocommerce_wpml->multi_currency->exchange_rate_services->get_currency_rate('KRW');

Relevant Documentation:

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 teameK 2 years, 7 months ago.

Assigned support staff: Bigul.

Author Posts
March 12, 2018 at 3:12 am #1543021

teameK

Tell us what you are trying to do?

What function gets the exchange rate information?

March 13, 2018 at 4:43 pm #1545039

Bigul
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

Hi,

Welcome to the WPML support forum. I will do my best to help you to resolve these issues.

Are you looking for an option to get the exchange rate if we specify a currency code?

To help you faster, I've enabled debug information for this support ticket. Please see this link for how to get this information from your site and give it to us: http://wpml.org/faq/provide-debug-information-faster-support/

--
Thanks!

Bigul

March 13, 2018 at 8:54 pm #1545268

teameK

I want php code that can be used in a php edit window like "get_curruncy_rate ()".

.
.
.
$curruncy_rate = ????;
$exchange_curruncy = $input_value * $curruncy_rate;
.
.
.

March 14, 2018 at 1:32 pm #1545838

Bigul
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

Hi,

We don't have API/hook function for this purpose. So please try with following code after a backup and check you are getting the expected result or not.

global $woocommerce_wpml;

echo $woocommerce_wpml->multi_currency->exchange_rate_services->get_currency_rate('KRW');

--
Thanks!

Bigul

March 14, 2018 at 4:05 pm #1546002

teameK

It works well.
Thank very much.