WC_Shipping::is_package_shippable()publicWC 1.0

See if package is shippable.

Packages are shippable until proven otherwise e.g. after getting a shipping country.

Method of the class: WC_Shipping{}

No Hooks.

Return

true|false.

Usage

$WC_Shipping = new WC_Shipping();
$WC_Shipping->is_package_shippable( $package );
$package(array) (required)
Package of cart items.

WC_Shipping::is_package_shippable() code WC 9.4.2

public function is_package_shippable( $package ) {
	// Packages are shippable until proven otherwise.
	if ( empty( $package['destination']['country'] ) ) {
		return true;
	}

	$allowed = array_keys( WC()->countries->get_shipping_countries() );
	return in_array( $package['destination']['country'], $allowed, true );
}