WC_Helper::get_filters_counts()public staticWC 1.0

Get counts data for the filters array.

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

No Hooks.

Return

Array. Filter counts (filter => count).

Usage

$result = WC_Helper::get_filters_counts( $subscriptions );
$subscriptions(array)
The array of all available subscriptions.
Default: null

Code of WC_Helper::get_filters_counts() WC 6.6.1

public static function get_filters_counts( $subscriptions = null ) {
	static $filters;

	if ( isset( $filters ) ) {
		return $filters;
	}

	$filters = array_fill_keys( array_keys( self::get_filters() ), 0 );
	if ( empty( $subscriptions ) ) {
		return array();
	}

	foreach ( $filters as $key => $count ) {
		$_subs = $subscriptions;
		self::_filter( $_subs, $key );
		$filters[ $key ] = count( $_subs );
	}

	return $filters;
}