Automattic\WooCommerce\Caches
OrderCountCacheService::update_on_order_trashed
Update the cache when an order is trashed.
Method of the class: OrderCountCacheService{}
No Hooks.
Returns
null. Nothing (null).
Usage
$OrderCountCacheService = new OrderCountCacheService(); $OrderCountCacheService->update_on_order_trashed( $order_id, $order );
- $order_id(int) (required)
- Order id.
- $order(WC_Order) (required)
- The order.
OrderCountCacheService::update_on_order_trashed() OrderCountCacheService::update on order trashed code WC 10.7.0
public function update_on_order_trashed( $order_id, $order ) {
if (
! $this->order_count_cache->is_cached( $order->get_type(), $this->get_prefixed_status( $order->get_status() ) ) ||
! $this->order_count_cache->is_cached( $order->get_type(), OrderStatus::TRASH ) ) {
return;
}
$this->order_count_cache->decrement( $order->get_type(), $this->get_prefixed_status( $order->get_status() ) );
$this->order_count_cache->increment( $order->get_type(), OrderStatus::TRASH );
}