Automattic\WooCommerce\Internal\ProductAttributesLookup
LookupDataStore::create_data_for_product_cpt()
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.
Method of the class: LookupDataStore{}
No Hooks.
Return
null
. Nothing (null).
Usage
// private - for code of main (parent) class only $result = $this->create_data_for_product_cpt( $product_id );
- $product_id(int) (required)
- Product or variation id.
LookupDataStore::create_data_for_product_cpt() LookupDataStore::create data for product cpt code 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; } }