wc_get_term_product_ids()WC 1.0

Return products in a given term, and cache value.

To keep in sync, product_count will be cleared on "set_object_terms".

No Hooks.

Return

Array.

Usage

wc_get_term_product_ids( $term_id, $taxonomy );
$term_id(int) (required)
Term ID.
$taxonomy(string) (required)
Taxonomy.

wc_get_term_product_ids() code WC 8.7.0

function wc_get_term_product_ids( $term_id, $taxonomy ) {
	$product_ids = get_term_meta( $term_id, 'product_ids', true );

	if ( false === $product_ids || ! is_array( $product_ids ) ) {
		$product_ids = get_objects_in_term( $term_id, $taxonomy );
		update_term_meta( $term_id, 'product_ids', $product_ids );
	}

	return $product_ids;
}