Automattic\WooCommerce\Internal\Admin

ShippingLabelBanner::should_show_meta_box()privateWC 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 8.7.0

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

		if ( defined( 'JETPACK__VERSION' ) ) {
			$jetpack_version = JETPACK__VERSION;
		}

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

		if ( class_exists( '\WC_Connect_Loader' ) ) {
			$wcs_version = \WC_Connect_Loader::get_wcs_version();
		}

		if ( class_exists( '\WC_Connect_Options' ) ) {
			$wcs_tos_accepted = \WC_Connect_Options::get_option( 'tos_accepted' );
		}

		$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(
				$jetpack_version,
				$jetpack_connected,
				$wcs_version,
				$wcs_tos_accepted,
				$incompatible_plugins
			);
	}

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