WC_Shipping::is_package_shippable( array $package )
See if package is shippable.
Description Description
Packages are shippable until proven otherwise e.g. after getting a shipping country.
Parameters Parameters
- $package
-
(Required) Package of cart items.
Return Return
(bool)
Source Source
File: includes/class-wc-shipping.php
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 );
}