Blocks

Exchange Rate Blocks

Exchange Rates with Fixer.io Service
Type: js
Categories: Exchange Rate
Plugins related: Generic
Requires license*

The block reads the exchange rates from the Fixer.io website

Enter the API Key

The block includes the xe_fixerio_exchange_rates operation whose parameter is a plain object with the following properties:

  • from: a three letters currency code. For example: USD (required)
  • to: a three letters currency code. For example: GBP (required)
  • field: a valid jQuery selector of an input tag for assigning the exchange rate. For example, if you are using the calculated fields form plugin, and you want to assign the exchange rate to the fieldname1 field, the selector would be: [id*="fieldname1_"] (optional)
  • callback: a function that will receive as parameter an object with all currencies codes and the corresponding exchange rates. For example: function(rates){alert(rates['EUR']);} (optional)
  • url: the URL to the public website. In cases where the URL to the public website and the WordPress are different, might be require pass to the block the URL to the public website (optional)

Example:

xe_fixerio_exchange_rates({'from': 'USD', 'to': 'EUR', 'field': '[id*="fieldname'+'1_"]'});

A specific example: Assuming there is a field in the form that calculate a service price in United State Dollars (USD), the fieldname1, and you want get the price in Euros (EUR), furthermore there is a hidde field for the exchange rate, the fieldname2. The equation to associate with the calculated field to calculate the price in Euros would be:

(function(){
xe_fixerio_exchange_rates({'from': 'USD', 'to': 'EUR', 'field': '[id*="fieldname'+'2_"]'});
return fieldname1*fieldname2;
})()

If there is a dropdown field for selecting the currency code, the fieldname3, the equation would be:

(function(){
xe_fixerio_exchange_rates({'from': 'USD', 'to': fieldname3, 'field': '[id*="fieldname'+'2_"]'});
return fieldname1*fieldname2;
})()

* The "Requires license" blocks are accessible, only if the plugin has been registered and the license is valid.
Exchange Rates with Free Currency Converter API
Type: js
Categories: Exchange Rate
Plugins related: Generic
Requires license*

The block reads the exchange rates from the Currency Converter API website

The block includes the currencyconverter operation whose parameter is a plain object with the following properties:

  • from: a three letters currency code. For example: USD (required)
  • to: a three letters currency code. For example: GBP (required)
  • field: a valid jQuery selector of an input tag for assigning the exchange rate. For example, if you are using the calculated fields form plugin, and you want to assign the exchange rate to the fieldname1 field, the selector would be: [id*="fieldname1_"] (optional)
  • callback: a function that will receive as parameter the corresponding exchange rate. For example: function(rate){alert(rate);} (optional)

Example:

currencyconverter({'from': 'USD', 'to': 'EUR', 'field': '[id*="fieldname'+'1_"]'});

A specific example: Assuming there is a field in the form that calculate a service price in United State Dollars (USD), the fieldname1, and you want get the price in Euros (EUR), furthermore there is a hidde field for the exchange rate, the fieldname2. The equation to associate with the calculated field to calculate the price in Euros would be:

(function(){
currencyconverter({'from': 'USD', 'to': 'EUR', 'field': '[id*="fieldname'+'2_"]'});
return fieldname1*fieldname2;
})()

If there is a dropdown field for selecting the currency code, the fieldname3, the equation would be:

(function(){
currencyconverter({'from': 'USD', 'to': fieldname3, 'field': '[id*="fieldname'+'2_"]'});
return fieldname1*fieldname2;
})()

* The "Requires license" blocks are accessible, only if the plugin has been registered and the license is valid.
Exchange Rates with the Open Exchange Rates Service
Type: js
Categories: Exchange Rate
Plugins related: Generic
Requires license*

The block reads the exchange rates from the Open Exchange Rates website

Enter the application ID

The block includes the xe_open_exchange_rates operation whose parameter is a plain object with the following properties:

  • from: a three letters currency code. For example: USD (required)
  • to: a three letters currency code. For example: GBP (required)
  • field: a valid jQuery selector of an input tag for assigning the exchange rate. For example, if you are using the calculated fields form plugin, and you want to assign the exchange rate to the fieldname1 field, the selector would be: [id*="fieldname1_"] (optional)
  • callback: a function that will receive as parameter an object with all currencies codes and the corresponding exchange rates. For example: function(rates){alert(rates['EUR']);} (optional)
  • url: the URL to the public website. In cases where the URL to the public website and the WordPress are different, might be require pass to the block the URL to the public website (optional)

Example:

xe_open_exchange_rates({'from': 'USD', 'to': 'EUR', 'field': '[id*="fieldname'+'1_"]'});

A specific example: Assuming there is a field in the form that calculate a service price in United State Dollars (USD), the fieldname1, and you want get the price in Euros (EUR), furthermore there is a hidde field for the exchange rate, the fieldname2. The equation to associate with the calculated field to calculate the price in Euros would be:

(function(){
xe_open_exchange_rates({'from': 'USD', 'to': 'EUR', 'field': '[id*="fieldname'+'2_"]'});
return fieldname1*fieldname2;
})()

If there is a dropdown field for selecting the currency code, the fieldname3, the equation would be:

(function(){
xe_open_exchange_rates({'from': 'USD', 'to': fieldname3, 'field': '[id*="fieldname'+'2_"]'});
return fieldname1*fieldname2;
})()

* The "Requires license" blocks are accessible, only if the plugin has been registered and the license is valid.
View All