WC_Shipping_Legacy_International_Delivery::is_available()publicWC 1.0

Check if package is available.

Метод класса: WC_Shipping_Legacy_International_Delivery{}

Хуки из метода

Возвращает

true|false.

Использование

$WC_Shipping_Legacy_International_Delivery = new WC_Shipping_Legacy_International_Delivery();
$WC_Shipping_Legacy_International_Delivery->is_available( $package );
$package(массив) (обязательный)
Package information.

Код WC_Shipping_Legacy_International_Delivery::is_available() WC 8.7.0

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 );
}