alg_tcmb_get_exchange_rate

Alg_tcmb_get_exchange_rate.

Description

alg_tcmb_get_exchange_rate( $currency_from, $currency_to ); 

Parameters (2)

0. $currency_from
The currency from.
1. $currency_to
The currency to.

Usage

  1. if ( !function_exists( 'alg_tcmb_get_exchange_rate' ) ) { 
  2. require_once ABSPATH . PLUGINDIR . 'booster-for-woocommerce/includes/functions/wcj-exchange-rates-functions.php'; 
  3.  
  4. // The currency from. 
  5. $currency_from = null; 
  6.  
  7. // The currency to. 
  8. $currency_to = null; 
  9.  
  10. // NOTICE! Understand what this does before running. 
  11. $result = alg_tcmb_get_exchange_rate($currency_from, $currency_to); 
  12.  

Defined (1)

The function is defined in the following location(s).

/includes/functions/wcj-exchange-rates-functions.php  
  1. function alg_tcmb_get_exchange_rate( $currency_from, $currency_to ) { 
  2. $currency_from_TRY = alg_tcmb_get_exchange_rate_TRY( strtoupper( $currency_from ) ); 
  3. if ( false == $currency_from_TRY ) { 
  4. return false; 
  5. $currency_to_TRY = alg_tcmb_get_exchange_rate_TRY( strtoupper( $currency_to ) ); 
  6. if ( false == $currency_to_TRY ) { 
  7. return false; 
  8. if ( 1 == $currency_to_TRY ) { 
  9. return round( $currency_from_TRY, 6 ); 
  10. return round( ( $currency_from_TRY / $currency_to_TRY ), 6 );