wc_get_term_product_ids( int $term_id, string $taxonomy )
Return products in a given term, and cache value.
Description Description
To keep in sync, product_count will be cleared on "set_object_terms".
Parameters Parameters
- $term_id
-
(Required) Term ID.
- $taxonomy
-
(Required) Taxonomy.
Return Return
(array)
Source Source
File: includes/wc-term-functions.php
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;
}