Automattic\WooCommerce\Internal\Admin

SiteHealth::has_legacy_shipping_methods_enabledprivateWC 1.0

Determine whether any legacy shipping methods are enabled.

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

Хуков нет.

Возвращает

true|false.

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

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

Код SiteHealth::has_legacy_shipping_methods_enabled() WC 11.0.1

private function has_legacy_shipping_methods_enabled() {
	$legacy_methods = array( 'flat_rate', 'free_shipping', 'international_delivery', 'local_delivery', 'local_pickup' );

	foreach ( $legacy_methods as $method ) {
		$options = get_option( 'woocommerce_' . $method . '_settings' );

		if ( $options && isset( $options['enabled'] ) && 'yes' === $options['enabled'] ) {
			return true;
		}
	}

	return false;
}