Automattic\WooCommerce\Internal\Admin\Schedulers

OrdersScheduler::delete()public staticWC 1.0

Delete a batch of orders.

Method of the class: OrdersScheduler{}

No Hooks.

Return

null. Nothing (null).

Usage

$result = OrdersScheduler::delete( $batch_size );
$batch_size(int) (required)
Number of items to delete.

OrdersScheduler::delete() code WC 8.7.0

public static function delete( $batch_size ) {
	global $wpdb;

	$order_ids = $wpdb->get_col(
		$wpdb->prepare(
			"SELECT order_id FROM {$wpdb->prefix}wc_order_stats ORDER BY order_id ASC LIMIT %d",
			$batch_size
		)
	);

	foreach ( $order_ids as $order_id ) {
		OrdersStatsDataStore::delete_order( $order_id );
	}
}