WordPress at Your Fingertips
function is not described

WC_Privacy::trash_pending_orders() public WC 3.4.0

Find and trash old orders.

{} It's a method of the class: WC_Privacy{}

Return

Int. Number of orders processed.

Usage

$result = WC_Privacy::trash_pending_orders( $limit );
$limit(int)
Limit orders to process per batch.
Default: 20

Changelog

Since 3.4.0 Introduced.

Code of WC_Privacy::trash_pending_orders() WC 5.9.0

public static function trash_pending_orders( $limit = 20 ) {
	$option = wc_parse_relative_date_option( get_option( 'woocommerce_trash_pending_orders' ) );

	if ( empty( $option['number'] ) ) {
		return 0;
	}

	return self::trash_orders_query(
		apply_filters(
			'woocommerce_trash_pending_orders_query_args',
			array(
				'date_created' => '<' . strtotime( '-' . $option['number'] . ' ' . $option['unit'] ),
				'limit'        => $limit, // Batches of 20.
				'status'       => 'wc-pending',
				'type'         => 'shop_order',
			)
		)
	);
}