Automattic\WooCommerce\Internal\DataStores\Orders

LegacyDataHandler::count_orders_for_cleanuppublicWC 1.0

Returns the total number of orders for which legacy post data can be removed.

Method of the class: LegacyDataHandler{}

No Hooks.

Returns

Int. Number of orders.

Usage

$LegacyDataHandler = new LegacyDataHandler();
$LegacyDataHandler->count_orders_for_cleanup( $order_ids ): int;
$order_ids(array)
If provided, total is computed only among IDs in this array, which can be either individual IDs or ranges like "100-200".
Default: array()

LegacyDataHandler::count_orders_for_cleanup() code WC 10.5.0

public function count_orders_for_cleanup( $order_ids = array() ): int {
	global $wpdb;
	return (int) $wpdb->get_var( $this->build_sql_query_for_cleanup( $order_ids, 'count' ) ); // phpcs:ignore WordPress.DB.PreparedSQL.NotPrepared -- prepared in build_sql_query_for_cleanup().
}