How to get the billing state in functions.php?
-
I want to change the paypal email based on billing state, below is my code, I just couldn’t get the billing_state value. Can anyone help please?
$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, $fields ) { global $woocommerce; if($fields['billing']['billing_state'] = 'New South Wales') { $paypal_args['business'] = '[email protected]'; } elseif($fields['billing']['billing_state'] = 'Victoria') { $paypal_args['business'] = '[email protected]'; } elseif($fields['billing']['billing_state'] = 'Tasmania') { $paypal_args['business'] = '[email protected]'; } return $paypal_args; }
Viewing 3 replies - 1 through 3 (of 3 total)
Viewing 3 replies - 1 through 3 (of 3 total)
- The topic ‘How to get the billing state in functions.php?’ is closed to new replies.