Automattic\WooCommerce\Caches

OrderCountCacheService::update_on_order_deletedpublicWC 1.0

Update the cache when an order is deleted.

Method of the class: OrderCountCacheService{}

No Hooks.

Returns

null. Nothing (null).

Usage

$OrderCountCacheService = new OrderCountCacheService();
$OrderCountCacheService->update_on_order_deleted( $order_id, $order );
$order_id(int) (required)
Order id.
$order(WC_Order) (required)
The order.

OrderCountCacheService::update_on_order_deleted() code WC 10.7.0

public function update_on_order_deleted( $order_id, $order ) {
	if ( ! $this->order_count_cache->is_cached( $order->get_type(), $this->get_prefixed_status( $order->get_status() ) ) ) {
		return;
	}

	$this->order_count_cache->decrement( $order->get_type(), $this->get_prefixed_status( $order->get_status() ) );
}