From 621448eecef771aba316be964f52ea962da857ea Mon Sep 17 00:00:00 2001 From: Reinhold Kainhofer <reinhold@kainhofer.com> Date: Tue, 14 Apr 2015 00:29:52 +0200 Subject: [PATCH] Add the order number post meta to the list of searchable fields --- woocommerce-advanced-ordernumbers.php | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/woocommerce-advanced-ordernumbers.php b/woocommerce-advanced-ordernumbers.php index 14219bd..73e866b 100644 --- a/woocommerce-advanced-ordernumbers.php +++ b/woocommerce-advanced-ordernumbers.php @@ -110,7 +110,9 @@ if ( in_array( 'woocommerce/woocommerce.php', apply_filters( 'active_plugins', g add_option ('ordernumber_step', '1'); // register actions - add_filter( 'woocommerce_get_sections_checkout', array($this, 'add_admin_section'),1); + add_filter( 'woocommerce_get_sections_checkout', array($this, 'add_admin_section')); + // Add the ordernumber post meta to the search in the backend + add_filter( 'woocommerce_shop_order_search_fields', array($this, 'order_search_fields')); // The checkout page assumes all subpages are payment gateways, so we have to override this: add_action( 'woocommerce_settings_checkout', array( $this, 'output' ) ); add_action( 'woocommerce_settings_save_checkout', array( $this, 'save' ) ); @@ -146,6 +148,15 @@ if ( in_array( 'woocommerce/woocommerce.php', apply_filters( 'active_plugins', g WC_Admin_Settings::save_fields( $settings ); } } + + /** + * Hook to add the order numer post meta field to the searchable field + * (so the admin can search for the order number in the backend) + */ + public function order_search_fields($fields) { + $fields[] = $this->ordernumber_meta; + return $fields; + } /** * Counter handling (simple loading/storing counters), storing them as options -- GitLab