WC_Privacy::trash_orders_query
For a given query trash all matches.
Method of the class: WC_Privacy{}
No Hooks.
Returns
Int. Count of orders that were trashed.
Usage
$result = WC_Privacy::trash_orders_query( $query );
- $query(array) (required)
- Query array to pass to wc_get_orders().
Changelog
| Since 3.4.0 | Introduced. |
WC_Privacy::trash_orders_query() WC Privacy::trash orders query code WC 10.4.3
protected static function trash_orders_query( $query ) {
$orders = wc_get_orders( $query );
$count = 0;
if ( $orders ) {
foreach ( $orders as $order ) {
$order->delete( false );
++$count;
}
}
return $count;
}