Automattic\WooCommerce\Internal\Admin

ShippingLabelBanner::should_show_meta_boxprivateWC 1.0

Check if WooCommerce Shipping makes sense for this merchant.

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

Хуков нет.

Возвращает

true|false.

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

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

Код ShippingLabelBanner::should_show_meta_box() WC 9.9.5

private function should_show_meta_box() {
	if ( ! $this->shipping_label_banner_display_rules ) {
		$dotcom_connected = null;
		$wcs_version      = null;

		if ( class_exists( Jetpack_Connection_Manager::class ) ) {
			$dotcom_connected = ( new Jetpack_Connection_Manager() )->has_connected_owner();
		}

		if ( class_exists( '\Automattic\WCShipping\Utils' ) ) {
			$wcs_version = \Automattic\WCShipping\Utils::get_wcshipping_version();
		}

		$incompatible_plugins = class_exists( '\WC_Shipping_Fedex_Init' ) ||
			class_exists( '\WC_Shipping_UPS_Init' ) ||
			class_exists( '\WC_Integration_ShippingEasy' ) ||
			class_exists( '\WC_ShipStation_Integration' );

		$this->shipping_label_banner_display_rules =
			new ShippingLabelBannerDisplayRules(
				$dotcom_connected,
				$wcs_version,
				$incompatible_plugins
			);
	}

	return $this->shipping_label_banner_display_rules->should_display_banner();
}