WC_Shipping_Legacy_International_Delivery::is_available()publicWC 1.0

Check if package is available.

Method of the class: WC_Shipping_Legacy_International_Delivery{}

Return

true|false.

Usage

$WC_Shipping_Legacy_International_Delivery = new WC_Shipping_Legacy_International_Delivery();
$WC_Shipping_Legacy_International_Delivery->is_available( $package );
$package(array) (required)
Package information.

WC_Shipping_Legacy_International_Delivery::is_available() code WC 9.4.2

public function is_available( $package ) {
	if ( 'no' === $this->enabled ) {
		return false;
	}
	if ( 'including' === $this->availability ) {
		if ( is_array( $this->countries ) && ! in_array( $package['destination']['country'], $this->countries, true ) ) {
			return false;
		}
	} else {
		if ( is_array( $this->countries ) && ( in_array( $package['destination']['country'], $this->countries, true ) || ! $package['destination']['country'] ) ) {
			return false;
		}
	}
	return apply_filters( 'woocommerce_shipping_' . $this->id . '_is_available', true, $package, $this );
}