DataRegenerator::initialize_table_and_data()privateWC 1.0

Create the lookup table and initialize the options that will be temporarily used while the regeneration is in progress.

Method of the class: DataRegenerator{}

No Hooks.


true|false. True if there's any product at all in the database, false otherwise.


// private - for code of main (parent) class only
$result = $this->initialize_table_and_data();

DataRegenerator::initialize_table_and_data() code WC 8.9.0

private function initialize_table_and_data() {
	$database_util = wc_get_container()->get( DatabaseUtil::class );
	$database_util->dbdelta( $this->get_table_creation_sql() );

	$last_existing_product_id = $this->get_last_existing_product_id();
	if ( ! $last_existing_product_id ) {
		// No products exist, nothing to (re)generate.
		return false;

	update_option( 'woocommerce_attribute_lookup_last_product_id_to_process', $last_existing_product_id );
	update_option( 'woocommerce_attribute_lookup_processed_count', 0 );

	return true;