Automattic\WooCommerce\Internal\ProductAttributesLookup
LookupDataStore::create_data_for
Create lookup table data for a given product.
Method of the class: LookupDataStore{}
No Hooks.
Returns
null. Nothing (null).
Usage
// private - for code of main (parent) class only $result = $this->create_data_for( $product );
- $product(WC_Product) (required)
- The product to create the data for.
LookupDataStore::create_data_for() LookupDataStore::create data for code WC 10.4.3
private function create_data_for( \WC_Product $product ) {
$this->last_create_operation_failed = false;
try {
if ( $this->is_variation( $product ) ) {
$this->create_data_for_variation( $product );
} elseif ( $this->is_variable_product( $product ) ) {
$this->create_data_for_variable_product( $product );
} else {
$this->create_data_for_simple_product( $product );
}
} catch ( \Exception $e ) {
$product_id = $product->get_id();
WC()->call_function( 'wc_get_logger' )->error(
"Lookup data creation (not optimized) failed for product $product_id: " . $e->getMessage(),
array(
'source' => 'palt-updates',
'exception' => $e,
'product_id' => $product_id,
)
);
$this->last_create_operation_failed = true;
}
}