Automattic\WooCommerce\Caches

ProductCountCacheService::update_on_new_product │ public │ WC 1.0

Устарела с версии 11.1. Больше не поддерживается и может быть удалена. Рекомендуется заменить эту функцию на аналог.

Update the cache when a new product is created.

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

Хуков нет.

Возвращает

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

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

$ProductCountCacheService = new ProductCountCacheService();
$ProductCountCacheService->update_on_new_product( $product_id, $product ): void;
$product_id(int) (обязательный)
Product ID.
$product(WC_Product) (обязательный)
The product.

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

Устарела с 11.1

Код ProductCountCacheService::update_on_new_product() WC 11.2.2

public function update_on_new_product( int $product_id, WC_Product $product ): void {
	// This was implemented to address a potential concurrency issue, but upon review, it was determined to be a false positive.
	// - Specifically, cache warming by a concurrent request between transition_post_status and woocommerce_new_product was considered.
	// - However, this scenario is a false positive because it occurs within the same PHP process, where hooks are executed sequentially.
}