Skip to content

Instantly share code, notes, and snippets.

@bhowe
Created September 28, 2020 16:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bhowe/e55ecf3967a59afcd1909b019240b7a8 to your computer and use it in GitHub Desktop.
Save bhowe/e55ecf3967a59afcd1909b019240b7a8 to your computer and use it in GitHub Desktop.
<?php
// Register new status
function register_outside_order_status() {
register_post_status( 'wc-outside', array(
'label' => 'Outside Waiting',
'public' => true,
'exclude_from_search' => false,
'show_in_admin_all_list' => true,
'show_in_admin_status_list' => true,
'label_count' => _n_noop( 'Outside Waiting (%s)', 'Outside Waiting (%s)' )
) );
}
add_action( 'init', 'register_outside_order_status' );
// Add to list of WC Order statuses
function add_outside_to_order_statuses( $order_statuses ) {
$new_order_statuses = array();
// add new order status after processing
foreach ( $order_statuses as $key => $status ) {
$new_order_statuses[ $key ] = $status;
if ( 'wc-processing' === $key ) {
$new_order_statuses['wc-outside'] = 'Outside Waiting';
}
}
return $new_order_statuses;
}
add_filter( 'wc_order_statuses', 'add_outside_to_order_statuses' );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment