/** * Mollie gateway for WooCommerce. Adds extra currencies to the "supported * currencies" list used by the Mollie payment plugin. * * HOW TO USE THIS CODE * Simply add the code to the bottom of your theme's functions.php file, and it * will run automatically. For more information: https://www.skyverge.com/blog/add-custom-code-to-wordpress/ * * GPL DISCLAIMER * Because this code program is free of charge, there is no warranty for it, 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 */ /** * Adds currencies to the list of currencies supported by Mollie. * IMPORTANT: this will prevent the Mollie gateway from disabling itself when an * unsupported currency is detecte, but it won't allow Mollie to accept * payments in the added currencies * * @param array currencies * @return array */ function aelia_add_mollie_currencies($currencies) { // Add USD to the currencies supported by Mollie. $currencies[] = 'USD'; return $currencies; } /** * Classes used by Mollie gateway. The class, in lower-case is also the ID of * the gateway. */ $aelia_mollie_classes = array( 'Mollie_WC_Gateway_BankTransfer', 'Mollie_WC_Gateway_BelfiusSepaRecurring', 'Mollie_WC_Gateway_Bitcoin', 'Mollie_WC_Gateway_CreditcardSubscription', 'Mollie_WC_Gateway_DirectDebit', 'Mollie_WC_Gateway_Giftcard', 'Mollie_WC_Gateway_IdealSepaRecurring', 'Mollie_WC_Gateway_Kbc', 'Mollie_WC_Gateway_MisterCashSepaRecurring', 'Mollie_WC_Gateway_PayPal', 'Mollie_WC_Gateway_Paysafecard', 'Mollie_WC_Gateway_SofortSepaRecurring', ); // Add a filter for each of the Mollie gateways, to alter the list of supported // currencies foreach($aelia_mollie_classes as $mollie_class) { $mollie_class = strtolower($mollie_class); add_filter("woocommerce_{$mollie_class}_supported_currencies", 'aelia_add_mollie_currencies'); }