Automattic\WooCommerce\Internal\StockNotifications

StockSyncController::process_queue │ public │ WC 1.0

Process the product IDs in the queue.

Called on shutdown to schedule Action Scheduler jobs for each product ID in the queue.

Method of the class: StockSyncController{}

Returns

void. Nothing (null).

Usage

$StockSyncController = new StockSyncController();
$StockSyncController->process_queue(): void;

StockSyncController::process_queue() code WC 11.3.0

public function process_queue(): void {
	$product_ids = array_filter( array_keys( $this->queue ) );
	$this->queue = array();

	if ( ! empty( $product_ids ) ) {
		foreach ( $product_ids as $product_id ) {
			$this->job_manager->schedule_initial_job_for_product( $product_id );
		}

		/**
		 * Allows for additional processing of the product IDs after they have been queued.
		 *
		 * @since 10.2.0
		 *
		 * @param array $product_ids The product IDs to process.
		 */
		do_action( 'woocommerce_customer_stock_notifications_product_sync', $product_ids );
	}

	// Store the notice last, so it can neither block the jobs above nor claim they are queued before they are.
	$this->store_admin_notice();
}