nevercrox.com

WooCommerce Create Custom Order Statuses

Pre-Requisites

There are no pre-requisites for this code snippet to work. Keep in mind this solution consists of two code snippets, one to display the content and one to style it.

How To Implement This Solution?

Add these two code snippets as separate entries in either your active child theme’s functions.php file or the Code Snippets plugin.

About The Snippet

Creating a custom order status in WooCommerce can be beneficial if your business processes involve extra steps. You might want to set a custom order status like “Dispatched”, “Exchanged”, or “Being Picked”. With this code snippet, you can create any custom status you need to suit your business and customer requirements.

Code Snippet 1 (Paste This Code In functions.php or Code Snippets )
/**
* Snippet Name:     Create custom WooCommerce order statuses.
* Snippet Author:   Nevercrox Solutions
*/

add_filter( 'woocommerce_register_shop_order_post_statuses', 'nevercrox_register_custom_order_status' );

function nevercrox_register_custom_order_status( $order_statuses ){
   $order_statuses['wc-custom-status'] = array(
      'label'                     => _x( 'Custom Status', 'Order status', 'woocommerce' ),
      'public'                    => false,
      'exclude_from_search'       => false,
      'show_in_admin_all_list'    => true,
      'show_in_admin_status_list' => true,
      'label_count'               => _n_noop( 'Custom Status <span class="count">(%s)</span>', 'Custom Status <span class="count">(%s)</span>', 'woocommerce' ),
   );
   return $order_statuses;
}

add_filter( 'wc_order_statuses', 'nevercrox_show_custom_order_status' );

function nevercrox_show_custom_order_status( $order_statuses ) {
   $order_statuses['wc-custom-status'] = _x( 'Custom Status', 'Order status', 'woocommerce' );
   return $order_statuses;
}

add_filter( 'bulk_actions-edit-shop_order', 'nevercrox_get_custom_order_status_bulk' );

function nevercrox_get_custom_order_status_bulk( $bulk_actions ) {
   $bulk_actions['mark_custom-status'] = 'Change status to custom status';
   return $bulk_actions;
}
?>


 

Just Added Blogs

Need A Specifc Blog ?

Request A Blog

Check Out More Related Snippets

0
Would love your thoughts, please comment.x
()
x