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.

Method of the class: WC_Admin_Marketplace_Promotions{}

No Hooks.

Return

null. Nothing (null).

Usage

$result = WC_Admin_Marketplace_Promotions::init();

WC_Admin_Marketplace_Promotions::init() code WC 9.0.1

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();
}