Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Advanced Order Numbers for WooCommerce
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Container registry
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
WooCommerce
Advanced Order Numbers for WooCommerce
Commits
8c00ea49
Commit
8c00ea49
authored
10 years ago
by
Reinhold Kainhofer
Browse files
Options
Downloads
Patches
Plain Diff
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
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
woocommerce-advanced-ordernumbers.php
+14
-0
14 additions, 0 deletions
woocommerce-advanced-ordernumbers.php
with
14 additions
and
0 deletions
woocommerce-advanced-ordernumbers.php
+
14
−
0
View file @
8c00ea49
...
...
@@ -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
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment