Automattic\WooCommerce\Internal\ProductAttributesLookup
LookupDataStore::create_data_for_product()
Create the lookup data for a given product, if a variable product is passed the information is created for all of its variations. This method is intended to be called from the data regenerator.
Method of the class: LookupDataStore{}
No Hooks.
Return
null
. Nothing (null).
Usage
$LookupDataStore = new LookupDataStore(); $LookupDataStore->create_data_for_product( $product );
- $product(int|WC_Product) (required)
- Product object or id.
LookupDataStore::create_data_for_product() LookupDataStore::create data for product code WC 8.7.0
public function create_data_for_product( $product ) { if ( ! is_a( $product, \WC_Product::class ) ) { $product = WC()->call_function( 'wc_get_product', $product ); } if ( $this->is_variation( $product ) ) { throw new \Exception( "LookupDataStore::create_data_for_product can't be called for variations." ); } $this->delete_data_for( $product->get_id() ); $this->create_data_for( $product ); }