Automattic\WooCommerce\Gateways\PayPal

Request::get_paypal_shipping_preferenceprivateWC 1.0

Get the shipping preference for the PayPal create-order request.

Method of the class: Request{}

No Hooks.

Returns

String.

Usage

// private - for code of main (parent) class only
$result = $this->get_paypal_shipping_preference( $order ): string;
$order(WC_Order) (required)
Order object.

Request::get_paypal_shipping_preference() code WC 10.7.0

private function get_paypal_shipping_preference( WC_Order $order ): string {
	if ( ! $order->needs_shipping() ) {
		return PayPalConstants::SHIPPING_NO_SHIPPING;
	}

	$address_override = $this->gateway->get_option( 'address_override' ) === 'yes';
	return $address_override ? PayPalConstants::SHIPPING_SET_PROVIDED_ADDRESS : PayPalConstants::SHIPPING_GET_FROM_FILE;
}