Created
May 5, 2016 14:38
-
-
Save DanielSantoro/e53516a7878438e1c15bfa2a8f2067d5 to your computer and use it in GitHub Desktop.
Free PayPal
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Get shipping args for paypal request. | |
* @param WC_Order $order | |
* @return array | |
*/ | |
protected function get_shipping_args( $order ) { | |
$shipping_args = array(); | |
if ( 'yes' == $this->gateway->get_option( 'send_shipping' ) ) { | |
$shipping_args['address_override'] = $this->gateway->get_option( 'address_override' ) === 'yes' ? 1 : 0; | |
$shipping_args['no_shipping'] = 0; | |
// If we are sending shipping, send shipping address instead of billing | |
$shipping_args['first_name'] = $order->shipping_first_name; | |
$shipping_args['last_name'] = $order->shipping_last_name; | |
$shipping_args['company'] = $order->shipping_company; | |
$shipping_args['address1'] = $order->shipping_address_1; | |
$shipping_args['address2'] = $order->shipping_address_2; | |
$shipping_args['city'] = $order->shipping_city; | |
$shipping_args['state'] = $this->get_paypal_state( $order->shipping_country, $order->shipping_state ); | |
$shipping_args['country'] = $order->shipping_country; | |
$shipping_args['zip'] = $order->shipping_postcode; | |
} else { | |
$shipping_args['no_shipping'] = 1; | |
} | |
return $shipping_args; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment