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".

Хуков нет.

Возвращает

Массив.

Использование

wc_get_term_product_ids( $term_id, $taxonomy );
$term_id(int) (обязательный)
Term ID.
$taxonomy(строка) (обязательный)
Taxonomy.

Код wc_get_term_product_ids() WC 9.4.2

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;
}