Automattic\WooCommerce\Internal\Admin

SiteHealth::needs_shipping_methodsprivateWC 1.0

Determine whether shipping is enabled but no methods are configured.

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

Хуков нет.

Возвращает

true|false.

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

// private - только в коде основоного (родительского) класса
$result = $this->needs_shipping_methods();

Код SiteHealth::needs_shipping_methods() WC 11.0.1

private function needs_shipping_methods() {
	if ( ! wc_shipping_enabled() ) {
		return false;
	}

	$product_count = wc_get_container()->get( ProductUtil::class )->get_counts_for_type( 'product' );

	return ( $product_count[ ProductStatus::PUBLISH ] ?? 0 ) > 0 && 0 === wc_get_shipping_method_count();
}