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

Assigned support staff: Harshad.

Author Posts
June 6, 2013 at 9:17 am #133468

Neil

I'm working on a custom woocommerce multi lingual site and want to pass the currency conversion into some javascript, is there a currency constnat like ICL_CURRENCY_CODE I can use?

June 6, 2013 at 10:27 am #133507

Harshad

Dear Neil,

You can use get_woocommerce_currency_symbol(); function to display the current currency code

<?php
$currency_code = get_woocommerce_currency_symbol();
echo $currency_code;
?>
June 6, 2013 at 3:22 pm #133616

Neil

Hi Harshad

Sorry for not being clear I want the conversion value so if GBP =1 when I switch to french EUR = 1.2 I want to get 1.2

June 7, 2013 at 8:42 am #133781

Harshad

Dear Neil,

You can use the following code to get current rate.

global $wpdb, $sitepress;
$rate = $wpdb->get_var("SELECT value FROM {$wpdb->prefix}icl_currencies WHERE language_code = '". $sitepress->get_current_language() ."'");
June 22, 2013 at 8:53 am #138055

Neil

That worked perfectly thanks