WordPress at Your Fingertips
function is not described

Automattic\WooCommerce\Internal\ProductAttributesLookup

LookupDataStore::run_update_callback() private WC 1.0

Perform an update of the lookup table for a specific product.

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

No Hooks.

Return

null. Nothing.

Usage

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

Code of LookupDataStore::run_update_callback() WC 5.9.0

private function run_update_callback( int $product_id, int $action ) {
	if ( ! $this->check_lookup_table_exists() ) {
		return;
	}

	$product = WC()->call_function( 'wc_get_product', $product_id );
	if ( ! $product ) {
		$action = self::ACTION_DELETE;
	}

	switch ( $action ) {
		case self::ACTION_INSERT:
			$this->delete_data_for( $product_id );
			$this->create_data_for( $product );
			break;
		case self::ACTION_UPDATE_STOCK:
			$this->update_stock_status_for( $product );
			break;
		case self::ACTION_DELETE:
			$this->delete_data_for( $product_id );
			break;
	}
}