From efd5ccebeb74bb0d27088cc112ac84e607433acc Mon Sep 17 00:00:00 2001 From: Vedanshu Jain Date: Thu, 25 Jan 2024 05:38:07 +0530 Subject: [PATCH] Add filters for customer email and order id for performance. (#43865) * Add filters for customer email and order id for performance. * Empty where should not cause invalid query. * Add changelog. * Add unit test for newly supported search params. * Apply coding standards. * Add a trailing wildcard to allow broader search. * Remove extra line. Co-authored-by: Corey McKrill <916023+coreymckrill@users.noreply.github.com> --- plugins/woocommerce/changelog/fix-41454-2 | 4 ++ .../src/Internal/Admin/Orders/ListTable.php | 8 ++-- .../Orders/OrdersTableSearchQuery.php | 22 +++++++++- .../Orders/OrdersTableQueryTests.php | 40 ++++++++++++++++++- 4 files changed, 69 insertions(+), 5 deletions(-) create mode 100644 plugins/woocommerce/changelog/fix-41454-2 diff --git a/plugins/woocommerce/changelog/fix-41454-2 b/plugins/woocommerce/changelog/fix-41454-2 new file mode 100644 index 00000000000..6c1f1226810 --- /dev/null +++ b/plugins/woocommerce/changelog/fix-41454-2 @@ -0,0 +1,4 @@ +Significance: minor +Type: enhancement + +HPOS: Add more select options when searching orders for Order ID and Customer email. diff --git a/plugins/woocommerce/src/Internal/Admin/Orders/ListTable.php b/plugins/woocommerce/src/Internal/Admin/Orders/ListTable.php index 64cf28d904d..0bc6335a6c5 100644 --- a/plugins/woocommerce/src/Internal/Admin/Orders/ListTable.php +++ b/plugins/woocommerce/src/Internal/Admin/Orders/ListTable.php @@ -1623,9 +1623,11 @@ class ListTable extends WP_List_Table { */ private function search_filter() { $options = array( - 'customers' => __( 'Customers', 'woocommerce' ), - 'products' => __( 'Products', 'woocommerce' ), - 'all' => __( 'All', 'woocommerce' ), + 'order_id' => __( 'Order ID', 'woocommerce' ), + 'customer_email' => __( 'Customer Email', 'woocommerce' ), + 'customers' => __( 'Customers', 'woocommerce' ), + 'products' => __( 'Products', 'woocommerce' ), + 'all' => __( 'All', 'woocommerce' ), ); ?>