Automattic\WooCommerce\Internal\Fulfillments\Providers

UPSShippingProvider::can_ship_from_topublicWC 1.0

Check if this provider can ship from a specific country.

Method of the class: UPSShippingProvider{}

No Hooks.

Returns

true|false. True if this provider can ship from the country, false otherwise.

Usage

$UPSShippingProvider = new UPSShippingProvider();
$UPSShippingProvider->can_ship_from_to( $shipping_from, $shipping_to ): bool;
$shipping_from(string) (required)
The country code from which the shipment is sent.
$shipping_to(string) (required)
The country code to which the shipment is sent.

UPSShippingProvider::can_ship_from_to() code WC 10.3.3

public function can_ship_from_to( string $shipping_from, string $shipping_to ): bool {
	if ( $shipping_from === $shipping_to ) {
		return in_array( $shipping_from, $this->domestic_shipping_countries, true ) ||
			in_array( $shipping_from, $this->domestic_but_international_tracking, true );
	} else {
		return in_array( $shipping_from, $this->international_shipping_countries, true ) &&
			in_array( $shipping_to, $this->international_shipping_countries, true );
	}
}