How to Add Custom Field Filters to WooCommerce Admin Order List
WooCommerce provides powerful tools for managing orders in the WordPress admin panel. By default, you can filter orders by status, date, or customer. However, in many real-world scenarios, it’s helpful to filter orders by custom meta fields. In this post, we’ll walk you through how to add a dropdown filter to the WooCommerce admin order list using a custom field.

This feature is especially useful when you’re storing additional metadata in your orders and want to manage them more efficiently. Once completed, your WooCommerce admin will support filtering orders by custom field values with full compatibility for both post-type and High-Performance Order Storage (HPOS) modes.
Step 1: Add a Custom Dropdown Filter to the Order List Table
To begin, we’ll add a dropdown to the order filter form in the admin area. We’ll use two hooks:
woocommerce_order_list_table_restrict_manage_orders
: for HPOS-based order filtering.restrict_manage_posts
: for legacy (post type) based orders.
Both hooks accept the same parameters, so we can use a single function for both.
add_action( 'woocommerce_order_list_table_restrict_manage_orders', 'wprs_order_filter', 25, 2 );
add_action( 'restrict_manage_posts', 'wprs_order_filter', 25, 2 );
function wprs_order_filter( $post_type, $which ) {
if ( 'shop_order' !== $post_type ) {
return;
}
$rudr_custom_field = isset( $_GET['rudr_custom_field'] ) ? $_GET['rudr_custom_field'] : '';
?>
<select name="rudr_custom_field">
<option value="">Custom field</option>
<option value="value-1"<?php selected( $rudr_custom_field, 'value-1' ); ?>>Value 1</option>
<option value="value-2"<?php selected( $rudr_custom_field, 'value-2' ); ?>>Value 2</option>
</select>
<?php
}
Step 2: Apply Filtering Logic to the Order Query
Now that the custom dropdown is added, we need to modify the order query logic so that the filter actually works. WooCommerce supports two different types of order storage, so we’ll use two hooks to cover both:
a. For HPOS Orders
Use the woocommerce_order_list_table_prepare_items_query_args
hook:
add_filter( 'woocommerce_order_list_table_prepare_items_query_args', function( $query_args ) {
if ( isset( $_GET['wprs_custom_field'] ) && $_GET['wprs_custom_field'] ) {
$query_args['meta_query'] = array(
array(
'key' => 'wprs_custom_field',
'value' => $_GET['wprs_custom_field'],
),
);
}
return $query_args;
} );
b. For Post-Type-Based Orders
Use the pre_get_posts
hook:
add_action( 'pre_get_posts', function( $query ) {
if ( ! is_admin() ) {
return;
}
global $pagenow;
// Ensure we are on the order list page
if ( 'edit.php' !== $pagenow || 'shop_order' !== $query->get( 'post_type' ) ) {
return;
}
if ( isset( $_GET['wprs_custom_field'] ) && $_GET['wprs_custom_field'] ) {
$query->set( 'meta_query', array(
array(
'key' => 'wprs_custom_field',
'value' => $_GET['wprs_custom_field'],
),
) );
}
} );
Final Thoughts
By following these steps, you’ll have successfully extended the WooCommerce admin order list with the ability to filter orders using a custom field. This solution supports both traditional and HPOS order data models, ensuring maximum compatibility across WooCommerce versions.
Whether you’re managing a marketplace, subscription system, or a complex fulfillment process, this small enhancement can greatly improve your admin workflow.