diff --git a/plugins/woocommerce/changelog/add-33196-admin-list-filtering b/plugins/woocommerce/changelog/add-33196-admin-list-filtering new file mode 100644 index 00000000000..6a6fb19b35e --- /dev/null +++ b/plugins/woocommerce/changelog/add-33196-admin-list-filtering @@ -0,0 +1,4 @@ +Significance: patch +Type: add + +Add support for filtering the Custom Order Table admin list UI. diff --git a/plugins/woocommerce/src/Internal/Admin/Orders/ListTable.php b/plugins/woocommerce/src/Internal/Admin/Orders/ListTable.php index 8b8723d24a3..c2f1479b722 100644 --- a/plugins/woocommerce/src/Internal/Admin/Orders/ListTable.php +++ b/plugins/woocommerce/src/Internal/Admin/Orders/ListTable.php @@ -19,6 +19,13 @@ class ListTable extends WP_List_Table { */ private $order_query_args = array(); + /** + * Tracks if a filter (ie, date or customer filter) has been applied. + * + * @var bool + */ + private $has_filter = false; + /** * Sets up the admin list table for orders (specifically, for orders managed by the OrdersTableDataStore). * @@ -41,7 +48,6 @@ class ListTable extends WP_List_Table { */ public function setup(): void { add_action( 'admin_notices', array( $this, 'bulk_action_notices' ) ); - add_filter( 'manage_woocommerce_page_wc-orders_columns', array( $this, 'get_columns' ) ); add_filter( 'set_screen_option_edit_orders_per_page', array( $this, 'set_items_per_page' ), 10, 3 ); add_filter( 'default_hidden_columns', array( $this, 'default_hidden_columns' ), 10, 2 ); @@ -73,7 +79,7 @@ class ListTable extends WP_List_Table { * @return mixed */ public function set_items_per_page( $default, string $option, int $value ) { - return 'edit_orders_per_page' === $option ? absint( $value ) : $default; + return $option === 'edit_orders_per_page' ? absint( $value ) : $default; } /** @@ -93,7 +99,7 @@ class ListTable extends WP_List_Table {