WordPress at Your Fingertips
function is not described

Automattic\WooCommerce\Internal\ProductAttributesLookup

LookupDataStore::create_data_for_simple_product() private WC 1.0

Create lookup table entries for a simple (non variable) product. Assumes that no entries exist yet.

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

No Hooks.

Return

null. Nothing.

Usage

// private - for code of main (parent) class only
$result = $this->create_data_for_simple_product( $product );
$product(WC_Product) (required)
The product to create the entries for.

Code of LookupDataStore::create_data_for_simple_product() WC 5.9.0

private function create_data_for_simple_product( \WC_Product $product ) {
	$product_attributes_data = $this->get_attribute_taxonomies( $product );
	$has_stock               = $product->is_in_stock();
	$product_id              = $product->get_id();
	foreach ( $product_attributes_data as $taxonomy => $data ) {
		$term_ids = $data['term_ids'];
		foreach ( $term_ids as $term_id ) {
			$this->insert_lookup_table_data( $product_id, $product_id, $taxonomy, $term_id, false, $has_stock );
		}
	}
}