Automattic\WooCommerce\Admin\Features\OnboardingTasks\Tasks

Shipping::has_shipping_zones()public staticWC 1.0

Check if the store has any shipping zones.

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

Хуков нет.

Возвращает

true|false.

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

$result = Shipping::has_shipping_zones();

Код Shipping::has_shipping_zones() WC 7.1.0

public static function has_shipping_zones() {
	$zone_count = get_transient( self::ZONE_COUNT_TRANSIENT_NAME );
	if ( false !== $zone_count ) {
		return (int) $zone_count > 0;
	}

	$zone_count = count( WC_Data_Store::load( 'shipping-zone' )->get_zones() );
	set_transient( self::ZONE_COUNT_TRANSIENT_NAME, $zone_count );

	return $zone_count > 0;
}