Automattic\WooCommerce\Caches

ProductCountCacheService::update_on_new_product │ public │ WC 1.0

Deprecated since 11.1. It is no longer supported and may be removed in future releases. It is recommended to replace this function with the same one.

Update the cache when a new product is created.

Method of the class: ProductCountCacheService{}

No Hooks.

Returns

void. Nothing (null).

Usage

$ProductCountCacheService = new ProductCountCacheService();
$ProductCountCacheService->update_on_new_product( $product_id, $product ): void;
$product_id(int) (required)
Product ID.
$product(WC_Product) (required)
The product.

Changelog

Deprecated since 11.1

ProductCountCacheService::update_on_new_product() code WC 11.1.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.
}