WC_Admin_Marketplace_Promotions::init()public staticWC 1.0

On all admin pages, try go get Marketplace promotions every day. Shows notice and adds menu badge to WooCommerce Extensions item if the promotions API requests them.

WC_Admin calls this method when it is instantiated during is_admin requests.

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

Хуков нет.

Возвращает

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

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

$result = WC_Admin_Marketplace_Promotions::init();

Код WC_Admin_Marketplace_Promotions::init() WC 9.4.2

public static function init() {
	// A legacy hook that can be triggered by action scheduler.
	add_action( 'woocommerce_marketplace_fetch_promotions', array( __CLASS__, 'clear_deprecated_action' ) );
	add_action( 'woocommerce_marketplace_fetch_promotions_clear', array( __CLASS__, 'clear_scheduled_event' ) );

	if (
		defined( 'DOING_AJAX' ) && DOING_AJAX
		|| defined( 'DOING_CRON' ) && DOING_CRON
		|| defined( 'WP_CLI' ) && WP_CLI
	) {
		return;
	}

	if ( ! is_admin() ) {
		return;
	}

	self::maybe_update_promotions();

	self::$locale = ( self::$locale ?? get_user_locale() ) ?? 'en_US';
	self::maybe_show_bubble_promotions();
}