How to dynamically change the PayPal address in Woocommerce?

Viewed 1848

I am trying to change the PayPal address that Woocommerce uses, depending on what page they are on. I only have 5 products at the moment, and all 5 need to use a different PayPal address.

I found this hook that can change the Paypal address, although not too sure how to add it in exactly (code is 3 years old apparently).

$paypal_args = apply_filters( 'woocommerce_paypal_args', $paypal_args );
add_filter( 'woocommerce_paypal_args' , 'custom_override_paypal_email' );

function custom_override_paypal_email( $paypal_args ) {
    $paypal_args['business'] = 'paypalemail@domain.com';
    print_r( $paypal_args['business'] );
    return $paypal_args;
}

How can I use this hook to change the Paypal address depending on which page/product the user is on?

1 Answers
Related