wc_recount_all_terms()WC 5.2

Recounts all terms.

Хуков нет.

Возвращает

null. Ничего (null).

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

wc_recount_all_terms();

Список изменений

С версии 5.2 Введена.

Код wc_recount_all_terms() WC 8.7.0

function wc_recount_all_terms() {
	$product_cats = get_terms(
		'product_cat',
		array(
			'hide_empty' => false,
			'fields'     => 'id=>parent',
		)
	);
	_wc_term_recount( $product_cats, get_taxonomy( 'product_cat' ), true, false );
	$product_tags = get_terms(
		'product_tag',
		array(
			'hide_empty' => false,
			'fields'     => 'id=>parent',
		)
	);
	_wc_term_recount( $product_tags, get_taxonomy( 'product_tag' ), true, false );
}