Automattic\WooCommerce\Internal\StockNotifications

StockSyncController::process_queuepublicWC 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

null. Nothing (null).

Usage

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

StockSyncController::process_queue() code WC 10.3.6

public function process_queue(): void {
	if ( empty( $this->queue ) || ! is_array( $this->queue ) ) {
		$this->queue = array();
		return;
	}

	$product_ids = array_filter( array_keys( $this->queue ) );
	if ( empty( $product_ids ) ) {
		return;
	}

	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 );
	$this->queue = array();
}