I'm looking to find a solution to my problem. I would like to change the PayPal email based on WooCommerce order total.
So, if order total is < 10$
- Receiver PayPal = paypalemail1@domain.com
Else
- Receiver PayPal = paypalemail2@domain.com
I tried to search here and the only code that I found was this:
add_filter( 'woocommerce_paypal_args', 'woocommerce_paypal_args', 10, 2 );
function woocommerce_paypal_args( $paypal_args, $order ) {
//Get the customer ID
$user_id = $order->get_user_id();
// Get the user data
$user_data = get_userdata( $customer_id );
// Adding an additional recipient for a custom user role
if ( in_array( 'wholesale_customer', $user_data->roles ) )
$paypal_args['business'] = 'email@email.com';
return $paypal_args;
}
But here is not based on WooCommerce order total but on the user role. Is there any way to personalise it?