WordPress at Your Fingertips
function is not described


LookupDataStore::create_data_for_product() public WC 1.0

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.

{} It's a method of the class: LookupDataStore{}

No Hooks.


null. Nothing.


$LookupDataStore = new LookupDataStore();
$LookupDataStore->create_data_for_product( $product );
$product(int|WC_Product) (required)
Product object or id.

Code of LookupDataStore::create_data_for_product() WC 5.9.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 );