Skip to content
Snippets Groups Projects
Commit 621448ee authored by Reinhold Kainhofer's avatar Reinhold Kainhofer
Browse files

Add the order number post meta to the list of searchable fields

parent 998eaf31
Branches
Tags
No related merge requests found
...@@ -110,7 +110,9 @@ if ( in_array( 'woocommerce/woocommerce.php', apply_filters( 'active_plugins', g ...@@ -110,7 +110,9 @@ if ( in_array( 'woocommerce/woocommerce.php', apply_filters( 'active_plugins', g
add_option ('ordernumber_step', '1'); add_option ('ordernumber_step', '1');
// register actions // 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: // 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_checkout', array( $this, 'output' ) );
add_action( 'woocommerce_settings_save_checkout', array( $this, 'save' ) ); add_action( 'woocommerce_settings_save_checkout', array( $this, 'save' ) );
...@@ -146,6 +148,15 @@ if ( in_array( 'woocommerce/woocommerce.php', apply_filters( 'active_plugins', g ...@@ -146,6 +148,15 @@ if ( in_array( 'woocommerce/woocommerce.php', apply_filters( 'active_plugins', g
WC_Admin_Settings::save_fields( $settings ); 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 * Counter handling (simple loading/storing counters), storing them as options
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment