Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tamarazuk/981552bc8dec35b3e004 to your computer and use it in GitHub Desktop.
Save tamarazuk/981552bc8dec35b3e004 to your computer and use it in GitHub Desktop.
Mollie Payment Gateway: Add compatibility for Payment Gateway Based Fees
<?php
/**
* Plugin Name: WooCommerce Mollie Gateway - Additional Fees Compatibility
* Plugin URI: http://www.woothemes.com/products/ideal-mollie/
* Description: Adds support for Payment Gateway Based Fees. Adds fees for each Mollie payment gateway based on fees listed at https://www.mollie.com/en/pricing
* Author: SkyVerge
* Author URI: http://www.skyverge.com
* Version: 1.0.0
*
* Copyright: (c) 2015 SkyVerge, Inc. (info@skyverge.com)
*
* License: GNU General Public License v3.0
* License URI: http://www.gnu.org/licenses/gpl-3.0.html
*
* @package WC-Mollie-Additional-Fees-Compatibility
* @author SkyVerge
* @category Compatibility
* @copyright Copyright (c) 2015, SkyVerge, Inc.
* @license http://www.gnu.org/licenses/gpl-3.0.html GNU General Public License v3.0
*/
/**
* Add Payment Gateway Based Fees compatability by filtering the
* `woocommerce_additional_fees` option and setting the specific fees for each
* Mollie payment method based on fees listed on https://www.mollie.com/en/pricing
*
* @param array $option_value The saved value of the `woocommerce_additional_fees` option (an associative array)
* @return array The filtered option value now including settings for each child gateway
*/
function sv_wc_mollie_payment_gateway_fees_compatibility( $option_value ) {
if ( isset( $option_value['gateways']['mollie'] ) ) {
$mollie_gateways = array(
'mollie_banktransfer' => array(
'enable' => true,
'outputtext' => 'Fee for Transfer:',
'taxclass' => 'Standard',
'addvaluetype' => 'add_percent',
'addvalue' => '0',
'addvalue_fix' => '0.25',
'maxvalue' => '0',
),
'mollie_creditcard' => array(
'enable' => true,
'outputtext' => 'Fee for Credit Card:',
'taxclass' => 'Standard',
'addvaluetype' => 'add_percent',
'addvalue' => '2.8',
'addvalue_fix' => '0.25',
'maxvalue' => '0',
),
'mollie_ideal' => array(
'enable' => true,
'outputtext' => 'Fee for iDEAL:',
'taxclass' => 'Standard',
'addvaluetype' => 'add_percent',
'addvalue' => '0',
'addvalue_fix' => '0.45',
'maxvalue' => '0',
),
'mollie_mistercash' => array(
'enable' => true,
'outputtext' => 'Fee for Mister Cash:',
'taxclass' => 'Standard',
'addvaluetype' => 'add_percent',
'addvalue' => '1.8',
'addvalue_fix' => '0.25',
'maxvalue' => '0',
),
'mollie_bitcoin' => array(
'enable' => true,
'outputtext' => 'Fee for Bitcoin:',
'taxclass' => 'Standard',
'addvaluetype' => 'add_percent',
'addvalue' => '0',
'addvalue_fix' => '0.25',
'maxvalue' => '0',
),
'mollie_paypal' => array(
'enable' => true,
'outputtext' => 'Fee for PayPal:',
'taxclass' => 'Standard',
'addvaluetype' => 'add_percent',
'addvalue' => '3.4',
'addvalue_fix' => '0.45',
'maxvalue' => '0',
),
'mollie_paysafecard' => array(
'enable' => true,
'outputtext' => 'Fee for Paysafecard:',
'taxclass' => 'Standard',
'addvaluetype' => 'add_percent',
'addvalue' => '15',
'addvalue_fix' => '0',
'maxvalue' => '0',
),
'mollie_sofort' => array(
'enable' => true,
'outputtext' => 'Fee for SOFORT:',
'taxclass' => 'Standard',
'addvaluetype' => 'add_percent',
'addvalue' => '0.9',
'addvalue_fix' => '0.25',
'maxvalue' => '0',
),
);
$option_value['gateways'] = array_merge( $option_value['gateways'], $mollie_gateways );
}
return $option_value;
}
add_filter( 'option_woocommerce_additional_fees', 'sv_wc_mollie_payment_gateway_fees_compatibility' );
@HardBug25
Copy link

Hi,

How do I setup this code to work it corretly?

Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment