businessdad icon

Currency Switcher - Add ECB provider from EU VAT Assistant

businessdad | PRO | 12/01/20 05:24:12 PM UTC (Edited) | 0 ⭐ | 963 👁️ | Never ⏰ | []
PHP |

1.63 KB

|

None

|

0 👍

/

0 👎

<?Php
/**
 * Aelia Currency Switcher - Add ECB Rates Provider from the EU VAT Assistant
 * to the list of the exhange rates providers used by the Currency Switcher.
 *
 * IMPORTANT
 * This code should only be used when the Aelia Currency Switcher and EU VAT Assistant 
 * are active. If you disable the latter, please make sure that you select a different
 * exchange rates provider, or the Currency Switcher could throw an error.
 * 
 * GPL DISCLAIMER
 * THE USE OF THIS CODE IS AS YOUR OWN RISK.
 * This code is provided free of charge and comes without any warranty, implied or explicit, to the extent permitted
 * by applicable law. Except when otherwise stated in writing the copyright holders and/or other parties provide the
 * program "as is" without warranty of any kind, either expressed or implied, including, but not limited to, the implied
 * warranties of merchantability and fitness for a particular purpose. The entire risk as to the quality and performance
 * of the program is with you. Should the program prove defective, you assume the cost of all necessary servicing, repair
 * or correction.
 *
 * Need a consultation, or assistance to customise this code? Find us on Codeable: https://aelia.co/hire_us
 */
add_filter('wc_aelia_cs_exchange_rates_models', function($exchange_rates_models) {
  if(class_exists('\Aelia\WC\EU_VAT_Assistant\Exchange_Rates_ECB_Model')) {
    // Pass the ECB Model to the Currency Switcher
    $exchange_rates_models['ecb'] = (object)array(
    'class_name' => '\Aelia\WC\EU_VAT_Assistant\Exchange_Rates_ECB_Model',
    'label' => 'ECB',
    );
  }
 
  return $exchange_rates_models;
});

Comments