Managing orders in WooCommerce can get messy as your store grows. If you’re using the new High-Performance Order Storage (HPOS) system, the default order list still doesn’t give you a quick way to filter by a custom date range.
In this guide, you’ll learn how to easily add a “From” and “To” date filter to your WooCommerce Admin Orders page. This lets you view only the orders placed within a specific time frame.
Some store owners notice their orders page slows down when filtering large datasets. If that happens to you, consider using Flexi Archiver to archive old orders while keeping data accessible.
Solution: Add a Date Range Filter to WooCommerce Admin Orders
The code below adds From/To date inputs to the WooCommerce Admin Orders page and filters orders within the selected date range, fully compatible with HPOS.
add_action('woocommerce_order_list_table_restrict_manage_orders', 'ts_add_orders_date_range_filter', 15);
function ts_add_orders_date_range_filter() {
?>
<label for="from_date"><?php esc_html_e('From Date:', 'woocommerce'); ?></label>
<input type="date" id="from_date" name="from_date" value="<?php echo isset($_GET['from_date']) ? esc_attr($_GET['from_date']) : ''; ?>" />
<label for="to_date"><?php esc_html_e('To Date:', 'woocommerce'); ?></label>
<input type="date" id="to_date" name="to_date" value="<?php echo isset($_GET['to_date']) ? esc_attr($_GET['to_date']) : ''; ?>" />
<?php
}
add_filter('woocommerce_order_list_table_prepare_items_query_args', 'ts_orders_from_date_range_filter');
function ts_orders_from_date_range_filter( $query_args ) {
if ( !isset($query_args['date_query']) ) {
$query_args['date_query'] = array();
}
if ( isset($_GET['from_date']) && !empty($_GET['from_date']) ) {
$query_args['date_query'][] = array(
'after' => esc_attr($_GET['from_date']),
'inclusive' => true,
);
}
if ( isset($_GET['to_date']) && !empty($_GET['to_date']) ) {
// Add one day to the date value
$to_date = date('Y-m-d', strtotime( esc_attr($_GET['to_date']) ) );
$query_args['date_query'][] = array(
'before' => $to_date,
'inclusive' => true,
);
}
return $query_args;
}
Output
When a date range is entered, the admin orders list filters to show only orders within that range.

Power users who need even more control over their Orders page can also add an “Order Origin” filter to WooCommerce admin orders page that helps you to quickly segment orders by source.

2 thoughts on “How to Add a Date Range Filter to WooCommerce Admin Orders Page (HPOS Compatible)?”
Works absolutly fine, don’t need to buy specific module, thank you for the huge money and time gain !
I fully recommand
Great to hear it worked well for you!