Automattic\WooCommerce\Admin\RemoteInboxNotifications

StoredStateSetupForProducts::update_stored_state_and_possibly_run_remote_notifications()private staticWC 1.0

Enqueues an async action (using action-scheduler) to run remote notifications.

Method of the class: StoredStateSetupForProducts{}

No Hooks.

Return

null. Nothing (null).

Usage

$result = StoredStateSetupForProducts::update_stored_state_and_possibly_run_remote_notifications();

StoredStateSetupForProducts::update_stored_state_and_possibly_run_remote_notifications() code WC 8.6.1

private static function update_stored_state_and_possibly_run_remote_notifications() {
	$stored_state = RemoteInboxNotificationsEngine::get_stored_state();
	// If the stored_state is the same, we don't need to run remote notifications to avoid unnecessary action scheduling.
	if ( true === $stored_state->there_are_now_products ) {
		return;
	}

	$stored_state->there_are_now_products = true;
	RemoteInboxNotificationsEngine::update_stored_state( $stored_state );

	// Run self::run_remote_notifications asynchronously.
	as_enqueue_async_action( self::ASYNC_RUN_REMOTE_NOTIFICATIONS_ACTION_NAME );
}