WordPress как на ладони
Недорогой хостинг для сайтов на WordPress: wordpress.jino.ru
функция не описана

WC_Shipping_Method::is_available() public WC 1.0

Is this method available?

{} Это метод класса: WC_Shipping_Method{}

Хуки из метода
Возвращает

true/false.

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

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

Код WC_Shipping_Method::is_available() WC 4.7.0

<?php
public function is_available( $package ) {
	$available = $this->is_enabled();

	// Country availability (legacy, for non-zone based methods).
	if ( ! $this->instance_id && $available ) {
		$countries = is_array( $this->countries ) ? $this->countries : array();

		switch ( $this->availability ) {
			case 'specific':
			case 'including':
				$available = in_array( $package['destination']['country'], array_intersect( $countries, array_keys( WC()->countries->get_shipping_countries() ) ) );
				break;
			case 'excluding':
				$available = in_array( $package['destination']['country'], array_diff( array_keys( WC()->countries->get_shipping_countries() ), $countries ) );
				break;
			default:
				$available = in_array( $package['destination']['country'], array_keys( WC()->countries->get_shipping_countries() ) );
				break;
		}
	}

	return apply_filters( 'woocommerce_shipping_' . $this->id . '_is_available', $available, $package, $this );
}