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{}

Хуков нет.


null. Ничего (null).


// private - только в коде основоного (родительского) класса
$result = $this->insert_lookup_table_data_for_variation( $variation, $taxonomy, $main_product_id, $term_ids, $term_ids_by_slug_cache );
$variation(\WC_Product_Variation) (обязательный)
The variation to create entries for.
$taxonomy(строка) (обязательный)
The taxonomy to create the entries for.
$main_product_id(int) (обязательный)
The parent product id.
$term_ids(массив) (обязательный)
The term ids to create entries for.
$term_ids_by_slug_cache(массив) (обязательный)
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 8.3.1

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 );