LookupDataStore::insert_lookup_table_data_for_variation()privateWC 1.0

Create lookup table entries for a given variation, corresponding to a given taxonomy and a set of term ids.

Метод класса: LookupDataStore{}

No Hooks.


null. Nothing.


// private - for code of main (parent) class only
$result = $this->insert_lookup_table_data_for_variation( $variation, $taxonomy, $main_product_id, $term_ids, $term_ids_by_slug_cache );
$variation(\WC_Product_Variation) (required)
The variation to create entries for.
$taxonomy(string) (required)
The taxonomy to create the entries for.
$main_product_id(int) (required)
The parent product id.
$term_ids(array) (required)
The term ids to create entries for.
$term_ids_by_slug_cache(array) (required)
A dictionary of term ids by term slug, as returned by 'get_term_ids_by_slug_cache'.

Код LookupDataStore::insert_lookup_table_data_for_variation() WC 7.1.0

private function insert_lookup_table_data_for_variation( \WC_Product_Variation $variation, string $taxonomy, int $main_product_id, array $term_ids, array $term_ids_by_slug_cache ) {
	$variation_id                 = $variation->get_id();
	$variation_has_stock          = $variation->is_in_stock();
	$variation_definition_term_id = $this->get_variation_definition_term_id( $variation, $taxonomy, $term_ids_by_slug_cache );
	if ( $variation_definition_term_id ) {
		$this->insert_lookup_table_data( $variation_id, $main_product_id, $taxonomy, $variation_definition_term_id, true, $variation_has_stock );
	} else {
		$term_ids_for_taxonomy = $term_ids;
		foreach ( $term_ids_for_taxonomy as $term_id ) {
			$this->insert_lookup_table_data( $variation_id, $main_product_id, $taxonomy, $term_id, true, $variation_has_stock );