Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Advanced Order Numbers for WooCommerce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
10
Issues
10
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
Operations
Operations
Incidents
Packages & Registries
Packages & Registries
Container Registry
Analytics
Analytics
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
WooCommerce
Advanced Order Numbers for WooCommerce
Commits
99ed5f31
Commit
99ed5f31
authored
Apr 19, 2015
by
Reinhold Kainhofer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Make it work in the FE, too
parent
6327cf30
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
17 additions
and
3 deletions
+17
-3
TODO
TODO
+1
-1
woocommerce-advanced-ordernumbers.php
woocommerce-advanced-ordernumbers.php
+16
-2
No files found.
TODO
View file @
99ed5f31
OpenTools Advanced Ordernumbers for WooCommerce - Open TODOs
============================================================
- Make sure the numbers are generated only for new orders, not for ex
si
ting ones
- Make sure the numbers are generated only for new orders, not for ex
is
ting ones
- Check REST API
- Would it make sense to configure the order password format?
- Find out how multisite works and make the plugin work with it
...
...
woocommerce-advanced-ordernumbers.php
View file @
99ed5f31
...
...
@@ -192,7 +192,7 @@ if ( in_array( 'woocommerce/woocommerce.php', apply_filters( 'active_plugins', g
// When a new order is created, we immediately assign the order number:
add_action
(
'wp_insert_post'
,
array
(
&
$this
,
'check_create_ordernumber'
),
10
,
3
);
add_action
(
'save_post'
,
array
(
&
$this
,
'check_create_ordernumber'
),
10
,
3
);
//
add_action( 'save_post', array(&$this, 'check_create_ordernumber'), 10, 3);
// The filter to actually return the order number for the given order
add_filter
(
'woocommerce_order_number'
,
array
(
&
$this
,
'get_ordernumber'
),
10
,
2
/*<= Also get the order object! */
);
}
...
...
@@ -533,6 +533,20 @@ if ( in_array( 'woocommerce/woocommerce.php', apply_filters( 'active_plugins', g
return
wp_parse_args
(
$custom
,
$columns
);
}
/**
* Add the "create new order number" action to the edit order page in the Backend
*/
public
function
add_order_action_new_number
(
$actions
)
{
$actions
[
'assign_new_ordernumber'
]
=
self
::
__
(
'Assign a new order number'
);
}
/**
* Handle the "Assign a new order number" action from the edit order page in the backend
*/
public
function
order_action_assign_new_ordernumber
(
$order
)
{
$number
=
$this
->
create_ordernumber
(
$order
->
id
,
$order
,
'ordernumber'
);
}
/**
* Handle new posts created in the frontend. This action will be called for all posts,
* not only for orders, so we need to check explicitly. Also, this function will be called
...
...
@@ -884,7 +898,7 @@ if ( in_array( 'woocommerce/woocommerce.php', apply_filters( 'active_plugins', g
* The hook to assign a customized order number (unless the order already has one assigned)
*/
function
assign_new_ordernumber
(
$orderid
,
$order
,
$update
=
true
)
{
if
((
!
$update
)
&&
(
$order
->
post_status
==
'auto-draft'
)
)
{
if
((
!
$update
)
/*&& ($order->post_status == 'auto-draft')*/
)
{
// New order => assign placeholder, which will later be overwritten the real order number
update_post_meta
(
$orderid
,
$this
->
ordernumber_meta
,
$this
->
ordernumber_new_placeholder
);
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment