Automattic\WooCommerce\Internal\DataStores\Orders

LegacyDataHandler::get_orders_for_cleanuppublicWC 1.0

Returns a set of orders for which legacy post data can be removed.

Method of the class: LegacyDataHandler{}

No Hooks.

Returns

Array[Int]. Order IDs.

Usage

$LegacyDataHandler = new LegacyDataHandler();
$LegacyDataHandler->get_orders_for_cleanup( $order_ids, $limit ): array;
$order_ids(array)
If provided, result is a subset of the order IDs in this array, which can contain either individual order IDs or ranges like "100-200".
Default: array()
$limit(int)
Limit the number of results.

LegacyDataHandler::get_orders_for_cleanup() code WC 10.7.0

public function get_orders_for_cleanup( $order_ids = array(), int $limit = 0 ): array {
	global $wpdb;

	return array_map(
		'absint',
		$wpdb->get_col( $this->build_sql_query_for_cleanup( $order_ids, 'ids', $limit ) ) // phpcs:ignore WordPress.DB.PreparedSQL.NotPrepared -- prepared in build_sql_query_for_cleanup().
	);
}