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.


Top ↑

Return Return

(bool)


Top ↑

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


Top ↑

User Contributed Notes User Contributed Notes

You must log in before being able to contribute a note or feedback.