WordPress at Your Fingertips
function is not described

Automattic\WooCommerce\Internal\ProductAttributesLookup

LookupDataStore::create_data_for_variation() private WC 1.0

Create all the necessary lookup data for a given variation.

{} 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_variation( $variation );
$variation(WC_Product_Variation) (required)
The variation to create entries for.

Code of LookupDataStore::create_data_for_variation() WC 5.9.0

private function create_data_for_variation( \WC_Product_Variation $variation ) {
	$main_product = WC()->call_function( 'wc_get_product', $variation->get_parent_id() );

	$product_attributes_data   = $this->get_attribute_taxonomies( $main_product );
	$variation_attributes_data = array_filter(
		$product_attributes_data,
		function( $item ) {
			return $item['used_for_variations'];
		}
	);

	$term_ids_by_slug_cache = $this->get_term_ids_by_slug_cache( array_keys( $variation_attributes_data ) );

	foreach ( $variation_attributes_data as $taxonomy => $data ) {
		$this->insert_lookup_table_data_for_variation( $variation, $taxonomy, $main_product->get_id(), $data['term_ids'], $term_ids_by_slug_cache );
	}
}