Automattic\WooCommerce\Internal

TermCount::get_count_affecting_visibility_term_taxonomy_ids │ private │ WC 1.0

Gets visibility term taxonomy IDs that affect WooCommerce product counts.

Method of the class: TermCount{}

No Hooks.

Returns

list<int>.

Usage

// private - for code of main (parent) class only
$result = $this->get_count_affecting_visibility_term_taxonomy_ids(): array;

TermCount::get_count_affecting_visibility_term_taxonomy_ids() code WC 11.2.1

private function get_count_affecting_visibility_term_taxonomy_ids(): array {
	/**
	 * Product visibility term taxonomy IDs.
	 *
	 * @var array $visibility_term_ids
	 */
	$visibility_term_ids = wc_get_product_visibility_term_ids();
	$counting_tt_ids     = array( $visibility_term_ids['exclude-from-catalog'] ?? 0 );

	if ( 'yes' === get_option( 'woocommerce_hide_out_of_stock_items' ) ) {
		$counting_tt_ids[] = $visibility_term_ids[ ProductStockStatus::OUT_OF_STOCK ] ?? 0;
	}

	return $this->normalize_ids( $counting_tt_ids );
}