WC_Privacy::trash_failed_orders( int $limit = 20 )
Find and trash old orders.
Description Description
Parameters Parameters
- $limit
-
(Optional) Limit orders to process per batch.
Default value: 20
Return Return
(int) Number of orders processed.
Source Source
File: includes/class-wc-privacy.php
public static function trash_failed_orders( $limit = 20 ) {
$option = wc_parse_relative_date_option( get_option( 'woocommerce_trash_failed_orders' ) );
if ( empty( $option['number'] ) ) {
return 0;
}
return self::trash_orders_query(
apply_filters(
'woocommerce_trash_failed_orders_query_args',
array(
'date_created' => '<' . strtotime( '-' . $option['number'] . ' ' . $option['unit'] ),
'limit' => $limit, // Batches of 20.
'status' => 'wc-failed',
'type' => 'shop_order',
)
)
);
}
Changelog Changelog
| Version | Description |
|---|---|
| 3.4.0 | Introduced. |