WordPress at Your Fingertips
function is not described

Automattic\WooCommerce\Internal\ProductAttributesLookup

LookupDataStore::get_variation_definition_term_id() private WC 1.0

Get the id of the term that defines a variation for a given taxonomy, or null if there's no such defining id (for variations having "Any <taxonomy>" as the definition)

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

No Hooks.

Return

Int|null. The term id, or null if there's no defining id for that taxonomy in that variation.

Usage

// private - for code of main (parent) class only
$result = $this->get_variation_definition_term_id( $variation, $taxonomy, $term_ids_by_slug_cache );
$variation(WC_Product_Variation) (required)
The variation to get the defining term id for.
$taxonomy(string) (required)
The taxonomy to get the defining term id for.
$term_ids_by_slug_cache(array) (required)
A term ids by slug as generated by get_term_ids_by_slug_cache.

Code of LookupDataStore::get_variation_definition_term_id() WC 5.9.0

private function get_variation_definition_term_id( \WC_Product_Variation $variation, string $taxonomy, array $term_ids_by_slug_cache ) {
	$variation_attributes = $variation->get_attributes();
	$term_slug            = ArrayUtil::get_value_or_default( $variation_attributes, $taxonomy );
	if ( $term_slug ) {
		return $term_ids_by_slug_cache[ $taxonomy ][ $term_slug ];
	} else {
		return null;
	}
}