Skip to content

Instantly share code, notes, and snippets.

@neovea
Forked from claudiosanches/functions.php
Last active September 1, 2016 17:55
Show Gist options
  • Save neovea/86461e07d1dd91e61027 to your computer and use it in GitHub Desktop.
Save neovea/86461e07d1dd91e61027 to your computer and use it in GitHub Desktop.
Combined to WooCommerce Adaptive Payment by WooTheme, offers the possibility to create dynamic amounts for specific paypal accounts. Put this snippet into functions.php
<?php
/**
* Custom PayPal Adaptive Payments args.
*
* @param array $args
* @param WC_Order $order
* @return array
*/
function wc_adaptive_payment_custom_args( $args, $order ) {
$args['receiverList'] = array(
'receiver' => array(
array(
'amount' => '40.00',
'email' => 'paypal-fs-de@dispostable.com'
// 'primary' => 'true' // use this only for Chained Payment.
),
array(
'amount' => '15.00',
'email' => 'paypal-fs-nl@dispostable.com'
),
array(
'amount' => '60.00',
'email' => 'paypal-fs-lx@dispostable.com'
)
)
);
return $args;
}
add_filter( 'woocommerce_paypal_ap_payment_args', 'custom_woocommerce_paypal_ap_payment_args', 10, 2 );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment