WC_Order_Item_Data_Store::clear_caches
Clear meta cache.
Method of the class: WC_Order_Item_Data_Store{}
No Hooks.
Returns
null. Nothing (null).
Usage
// protected - for code of main (parent) or child class $result = $this->clear_caches( $item_id, $order_id );
- $item_id(int) (required)
- Item ID.
- $order_id(int|null) (required)
- Order ID. If not set, it will be loaded using the item ID.
WC_Order_Item_Data_Store::clear_caches() WC Order Item Data Store::clear caches code WC 10.8.1
protected function clear_caches( $item_id, $order_id ) {
wp_cache_delete( 'item-' . $item_id, 'order-items' );
if ( ! $order_id ) {
$order_id = $this->get_order_id_by_order_item_id( $item_id );
}
if ( $order_id ) {
wp_cache_delete( 'order-items-' . $order_id, 'orders' );
wp_cache_delete( 'order-needs-processing-' . $order_id, 'orders' );
}
}