WC_Product_Usage_Notice::maybe_show_product_usage_notice
Maybe show product usage notice in a given screen object.
Method of the class: WC_Product_Usage_Notice{}
No Hooks.
Returns
null. Nothing (null).
Usage
$result = WC_Product_Usage_Notice::maybe_show_product_usage_notice( $screen );
- $screen(WP_Screen) (required)
- Current \WP_Screen object.
WC_Product_Usage_Notice::maybe_show_product_usage_notice() WC Product Usage Notice::maybe show product usage notice code WC 10.3.3
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;
}
try {
self::$product_usage_notice_rules = WC_Helper::get_product_usage_notice_rules();
} catch ( Exception $e ) {
return;
}
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' ) );
}