WordPress at Your Fingertips
function is not described

wc_get_product_taxonomy_class() WC 3.4.0

Get product taxonomy HTML classes.

No Hooks.

Return

Array.

Usage

wc_get_product_taxonomy_class( $term_ids, $taxonomy );
$term_ids(array) (required)
Array of terms IDs or objects.
$taxonomy(string) (required)
Taxonomy.

Changelog

Since 3.4.0 Introduced.

Code of wc_get_product_taxonomy_class() WC 5.6.0

function wc_get_product_taxonomy_class( $term_ids, $taxonomy ) {
	$classes = array();

	foreach ( $term_ids as $term_id ) {
		$term = get_term( $term_id, $taxonomy );

		if ( empty( $term->slug ) ) {
			continue;
		}

		$term_class = sanitize_html_class( $term->slug, $term->term_id );
		if ( is_numeric( $term_class ) || ! trim( $term_class, '-' ) ) {
			$term_class = $term->term_id;
		}

		// 'post_tag' uses the 'tag' prefix for backward compatibility.
		if ( 'post_tag' === $taxonomy ) {
			$classes[] = 'tag-' . $term_class;
		} else {
			$classes[] = sanitize_html_class( $taxonomy . '-' . $term_class, $taxonomy . '-' . $term->term_id );
		}
	}

	return $classes;
}