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

Make the order list sortable by the order number rather than the order ID

parent 44921923
No related branches found
No related tags found
No related merge requests found
......@@ -116,6 +116,9 @@ if ( in_array( 'woocommerce/woocommerce.php', apply_filters( 'active_plugins', g
// 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' ) );
// Sort the order list in the backend by order number rather than ID, make sure this is called LAST so we modify the defaults passed as arguments
add_filter( 'manage_edit-shop_order_sortable_columns', array( $this, 'modify_order_column_sortkey' ), 9999 );
// register filters
add_filter("plugin_action_links_$plugin", array(&$this, 'plugin_settings_link'));
......@@ -157,6 +160,17 @@ if ( in_array( 'woocommerce/woocommerce.php', apply_filters( 'active_plugins', g
$fields[] = $this->ordernumber_meta;
return $fields;
}
/**
* Sort the order list's "Order" column by our post meta rather than by ID
*/
public function modify_order_column_sortkey($columns) {
$custom = array(
'order_title' => $this->ordernumber_meta,
);
// Use the passed columns as "default", so effectively, only the order_title will be changed:
return wp_parse_args ($custom, $columns);
}
/**
* 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