Automattic\WooCommerce\Internal

TermCount::handle_deleted_term_relationships │ public │ WC 11.2.0

Recounts product terms after count-affecting visibility relationships are deleted.

Метод класса: TermCount{}

Хуков нет.

Возвращает

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

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

$TermCount = new TermCount();
$TermCount->handle_deleted_term_relationships( $object_id, $tt_ids, $taxonomy ): void;
$object_id(int) (обязательный)
Object ID.
$tt_ids(array<int|string>) (обязательный)
Deleted term taxonomy IDs.
$taxonomy(строка) (обязательный)
Taxonomy slug.

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

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

Код TermCount::handle_deleted_term_relationships() WC 11.2.2

public function handle_deleted_term_relationships( $object_id, $tt_ids, $taxonomy ): void {
	$object_id = absint( $object_id );

	if ( 'product_visibility' !== $taxonomy || 0 === $object_id || ! is_array( $tt_ids ) ) {
		return;
	}

	if (
		! empty(
			array_intersect(
				$this->normalize_ids( $tt_ids ),
				$this->get_count_affecting_visibility_term_taxonomy_ids()
			)
		)
	) {
		_wc_recount_terms_by_product( $object_id );
	}
}