WordPress at Your Fingertips
function is not described

Automattic\WooCommerce\Internal\ProductAttributesLookup

LookupDataStore::maybe_schedule_update() private WC 1.0

Schedule an update of the product attributes lookup table for a given product. If an update for the same action is already scheduled, nothing is done.

If the 'woocommerce_attribute_lookup_direct_update' option is set to 'yes', the update is done directly, without scheduling.

{} It's a method of the class: LookupDataStore{}

No Hooks.

Return

null. Nothing.

Usage

// private - for code of main (parent) class only
$result = $this->maybe_schedule_update( $product_id, $action );
$product_id(int) (required)
The product id to schedule the update for.
$action(int) (required)
The action to perform, one of the ACTION_ constants.

Code of LookupDataStore::maybe_schedule_update() WC 5.9.0

private function maybe_schedule_update( int $product_id, int $action ) {
	if ( 'yes' === get_option( 'woocommerce_attribute_lookup_direct_updates' ) ) {
		$this->run_update_callback( $product_id, $action );
		return;
	}

	$args = array( $product_id, $action );

	$queue             = WC()->get_instance_of( \WC_Queue::class );
	$already_scheduled = $queue->search(
		array(
			'hook'   => 'woocommerce_run_product_attribute_lookup_update_callback',
			'args'   => $args,
			'status' => \ActionScheduler_Store::STATUS_PENDING,
		),
		'ids'
	);

	if ( empty( $already_scheduled ) ) {
		$queue->schedule_single(
			WC()->call_function( 'time' ) + 1,
			'woocommerce_run_product_attribute_lookup_update_callback',
			$args,
			'woocommerce-db-updates'
		);
	}
}