Automattic\WooCommerce\Internal\ProductAttributesLookup

LookupDataStore::create_data_for_product_cpt()privateWC 1.0

Create the lookup table data for a product or variation using optimized database access. For variable products entries are created for the main product and for all the variations.

Метод класса: LookupDataStore{}

Хуков нет.

Возвращает

null. Ничего (null).

Использование

// private - только в коде основоного (родительского) класса
$result = $this->create_data_for_product_cpt( $product_id );
$product_id(int) (обязательный)
Product or variation id.

Код LookupDataStore::create_data_for_product_cpt() WC 9.3.3

private function create_data_for_product_cpt( int $product_id ) {
	$this->last_create_operation_failed = false;

	try {
		$this->create_data_for_product_cpt_core( $product_id );
	} catch ( \Exception $e ) {
		$data = array(
			'source'     => 'palt-updates',
			'product_id' => $product_id,
		);

		if ( $e instanceof \WC_Data_Exception ) {
			$data = array_merge( $data, $e->getErrorData() );
		} else {
			$data['exception'] = $e;
		}

		WC()->call_function( 'wc_get_logger' )
			->error( "Lookup data creation (optimized) failed for product $product_id: " . $e->getMessage(), $data );

		$this->last_create_operation_failed = true;
	}
}