WC_Admin_Marketplace_Promotions::init
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 Admin Marketplace Promotions::init WC 10.3.4
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_deprecated_scheduled_event',
)
);
// Fetch promotions from the API and store them in a transient.
add_action( self::CRON_NAME, array( __CLASS__, 'update_promotions' ) );
if (
defined( 'DOING_AJAX' ) && DOING_AJAX
|| defined( 'DOING_CRON' ) && DOING_CRON
|| defined( 'WP_CLI' ) && WP_CLI
) {
return;
}
if ( ! is_admin() ) {
return;
}
self::schedule_cron_event();
register_deactivation_hook( WC_PLUGIN_FILE, array( __CLASS__, 'clear_cron_event' ) );
self::$locale = ( self::$locale ?? get_user_locale() ) ?? 'en_US';
self::maybe_show_bubble_promotions();
}