Skip to content

Instantly share code, notes, and snippets.

@claudiosanches
Created September 12, 2014 13:49
Show Gist options
  • Star 7 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save claudiosanches/e68e891d593c4c989d9d to your computer and use it in GitHub Desktop.
Save claudiosanches/e68e891d593c4c989d9d to your computer and use it in GitHub Desktop.
WooCommerce 2.2 - Register new order statuses.
<?php
// My new order statuses.
function register_my_new_order_statuses() {
register_post_status( 'wc-status-name', array(
'label' => _x( 'Status Name', 'Order status', 'textdomain' ),
'public' => true,
'exclude_from_search' => false,
'show_in_admin_all_list' => true,
'show_in_admin_status_list' => true,
'label_count' => _n_noop( 'Status name <span class="count">(%s)</span>', 'Status names <span class="count">(%s)</span>', 'textdomain' )
) );
}
add_action( 'init', 'register_my_new_order_statuses' );
// Register in wc_order_statuses.
function my_new_wc_order_statuses( $order_statuses ) {
$order_statuses['wc-status-name'] = _x( 'Status Name', 'Order status', 'textdomain' );
return $order_statuses;
}
add_filter( 'wc_order_statuses', 'my_new_wc_order_statuses' );
@rajat24
Copy link

rajat24 commented Feb 16, 2016

I also have a similar issue like @jwad93. I want to send emails as soon as the status of product gets changed.
But in Woocommerce>Settings>Email only predefined options are present. For every status we hava a file separately stored in woocommerce>templates>emails.

So do I need to create a new file for every custom order status??

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment