Automattic\WooCommerce\Internal\DataStores\Orders
LegacyDataHandler::count_orders_for_cleanup
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() 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().
}