Add Custom Date Range Filters to WooCommerce Orders with HPOS

Last updated on January 12th, 2026
WordPress Logo WooCommerce

Contents

Managing WooCommerce orders becomes challenging as your store grows. While WooCommerce provides basic date filters dropdown, it doesn’t allow store admins to filter orders using a custom from–to date range directly from the WooCommerce -> Orders page.

In this tutorial, we’ll show you how to add a date range filter to the WooCommerce Admin Orders page that works seamlessly with High-Performance Order Storage (HPOS).

This solution is lightweight, code-based, and compatible with modern WooCommerce setups.

Why Add a Date Range Filter to WooCommerce Orders?

Filtering orders by a custom date range is extremely useful when you want to:

  • View orders from a specific campaign period
  • Generate weekly or monthly reports
  • Quickly locate historical orders
  • Improve admin productivity

By adding From Date and To Date fields, you gain precise control over which orders appear in the admin list.

Compatibility Details

This method is fully compatible with:

  • WooCommerce HPOS (High-Performance Order Storage)
  • Latest WordPress versions
  • Latest WooCommerce versions
  • Default WooCommerce admin Orders screen

No third-party plugins are required.

Step 1: Add Date Range Fields to the Orders Page

The first step is to add two date picker fields (From Date and To Date) to the WooCommerce Orders admin screen.

/**
* Add From and To date fields to WooCommerce admin orders filter
*/
add_action( 'woocommerce_order_list_table_restrict_manage_orders', 'cwd_add_date_range_fields', 15 );
function cwd_add_date_range_fields() {
?>
<label for="cwd_from_date"><?php esc_html_e( 'From Date:', 'woocommerce' ); ?></label>
<input type="date" id="cwd_from_date" name="cwd_from_date" value="<?php echo isset( $_GET['cwd_from_date'] ) ? esc_attr( $_GET['cwd_from_date'] ) : ''; ?>" />

<label for="cwd_to_date"><?php esc_html_e( 'To Date:', 'woocommerce' ); ?></label>
<input type="date" id="cwd_to_date" name="cwd_to_date" value="<?php echo isset( $_GET['cwd_to_date'] ) ? esc_attr( $_GET['cwd_to_date'] ) : ''; ?>" />
<?php
}

Step 2: Filter Orders Using the Selected Date Range

Next, we’ll update the WooCommerce orders query to filter results based on the selected dates.

/**
 * Filter WooCommerce admin orders by selected date range
 */
add_filter( 'woocommerce_order_list_table_prepare_items_query_args', 'cwd_filter_orders_by_date_range' );
function cwd_filter_orders_by_date_range( $query_args ) {

    if ( ! isset( $query_args['date_query'] ) ) {
        $query_args['date_query'] = [];
    }

    // From Date filter
    if ( ! empty( $_GET['cwd_from_date'] ) ) {
        $query_args['date_query'][] = [
            'after'     => sanitize_text_field( $_GET['cwd_from_date'] ),
            'inclusive' => true,
        ];
    }

    // To Date filter
    if ( ! empty( $_GET['cwd_to_date'] ) ) {
        $query_args['date_query'][] = [
            'before'    => sanitize_text_field( $_GET['cwd_to_date'] ),
            'inclusive' => true,
        ];
    }

    return $query_args;
}

Output:

Once the date range is selected, the WooCommerce admin Orders page updates automatically to display only the orders that fall within the chosen date range.

The From Date and To Date fields appear at the top of the Orders screen, allowing store administrators to quickly narrow down results without scrolling through unnecessary records. This makes order tracking, reporting, and daily management much faster and more efficient.

As shown below, only orders placed between the selected dates are displayed in the admin orders list, with full compatibility for HPOS-enabled stores.

Your Website Success Starts Here—and with Creative Werk Designs, It’s Guaranteed.

Schedule a free 45-minute consultation with your new team, and let’s explore how we can turn your website vision into measurable success stories. Your success starts here.

Hire Image