WordPress at Your Fingertips
function is not described


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.


null. Nothing.


// 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 );

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

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

	if ( empty( $already_scheduled ) ) {
			WC()->call_function( 'time' ) + 1,