Skip to content

Instantly share code, notes, and snippets.

@claudiosanches
Created July 1, 2014 19:46
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save claudiosanches/cdf77f6b2be0a6d92937 to your computer and use it in GitHub Desktop.
Save claudiosanches/cdf77f6b2be0a6d92937 to your computer and use it in GitHub Desktop.
Custom PayPal Adaptive Payments args
<?php
/**
* Custom PayPal Adaptive Payments args.
*
* @param array $args
* @param WC_Order $order
* @return array
*/
function custom_woocommerce_paypal_ap_payment_args( $args, $order ) {
$args['receiverList'] = array(
'receiver' => array(
array(
'amount' => '40.00',
'email' => 'your@email.com',
// 'primary' => 'true' // use this only for Chained Payment.
)
),
'receiver' => array(
array(
'amount' => '15.00',
'email' => 'receiver1@email.com'
)
),
'receiver' => array(
array(
'amount' => '60.00',
'email' => 'receiver2@email.com'
)
)
);
return $args;
}
add_filter( 'woocommerce_paypal_ap_payment_args', 'custom_woocommerce_paypal_ap_payment_args', 10, 2 );
@manoj611
Copy link

If you get only last amount than try this code
EX:

$receivers => array(
array(
'amount'=>reviever amount FIRST here,
'email'=> reviever paypal FIRST email here here
),
array(
'amount'=>reviever amount SECOND here,
'email'=> reviever paypal SECOND email here here
),
array(
'amount'=>reviever amount THIRD here,
'email'=> reviever paypal THIRD email here here
)
);

$args['receiverList'] = array(
    'receiver' => array($receivers)
);
return $args;

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