diff --git a/woocommerce-advanced-ordernumbers.php b/woocommerce-advanced-ordernumbers.php index 14219bd34ebf2dd98e593d774298d225572d3152..73e866b449313c07916f439e131b5a90be3c0fef 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