Automattic\WooCommerce\Internal\Caches
OrdersVersionStringInvalidator::handle_woocommerce_order_status_changed
Handle the woocommerce_order_status_changed hook.
Status changes affect which orders appear in status-filtered collection endpoints, so we always invalidate the orders list.
Method of the class: OrdersVersionStringInvalidator{}
No Hooks.
Returns
null. Nothing (null).
Usage
$OrdersVersionStringInvalidator = new OrdersVersionStringInvalidator(); $OrdersVersionStringInvalidator->handle_woocommerce_order_status_changed( $order_id, $from_status, $to_status, $order ): void;
- $order_id(int) (required)
- The order ID.
- $from_status(string) (required)
- The old status.
- $to_status(string) (required)
- The new status.
- $order(WC_Order) (required)
- The order object.
Changelog
| Since 10.6.0 | Introduced. |
OrdersVersionStringInvalidator::handle_woocommerce_order_status_changed() OrdersVersionStringInvalidator::handle woocommerce order status changed code WC 10.7.0
public function handle_woocommerce_order_status_changed( $order_id, $from_status, $to_status, $order ): void {
$this->invalidate( (int) $order_id );
$this->invalidate_orders_list();
}