WC_Product_Usage_Notice::maybe_show_product_usage_notice()public staticWC 1.0

Maybe show product usage notice in a given screen object.

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

Хуков нет.

Возвращает

null. Ничего (null).

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

$result = WC_Product_Usage_Notice::maybe_show_product_usage_notice( $screen );
$screen(\WP_Screen) (обязательный)
Current \WP_Screen object.

Код WC_Product_Usage_Notice::maybe_show_product_usage_notice() WC 9.4.2

public static function maybe_show_product_usage_notice( $screen ) {
	$user_id = get_current_user_id();
	if ( ! $user_id ) {
		return;
	}

	if ( ! WC_Helper::is_site_connected() ) {
		return;
	}

	self::$product_usage_notice_rules = WC_Helper::get_product_usage_notice_rules();
	if ( empty( self::$product_usage_notice_rules ) ) {
		return;
	}

	self::$current_notice_rule = self::get_current_notice_rule( $screen );
	if ( empty( self::$current_notice_rule ) ) {
		return;
	}

	$product_id = self::$current_notice_rule['id'];

	if ( self::is_notice_throttled( $user_id, $product_id ) ) {
		return;
	}

	add_action( 'admin_enqueue_scripts', array( __CLASS__, 'enqueue_product_usage_notice_scripts' ) );
}