Register statuses for orders

This commit is contained in:
Mike Jolley 2014-05-30 15:24:53 +01:00
parent 6e3820b635
commit 127bcc7d35
1 changed files with 55 additions and 0 deletions

View File

@ -23,6 +23,7 @@ class WC_Post_types {
public static function init() {
add_action( 'init', array( __CLASS__, 'register_taxonomies' ), 5 );
add_action( 'init', array( __CLASS__, 'register_post_types' ), 5 );
add_action( 'init', array( __CLASS__, 'register_post_status' ), 10 );
}
/**
@ -355,6 +356,60 @@ class WC_Post_types {
);
}
}
/**
* Register our custom post statuses, used for order status
*/
public static function register_post_status() {
register_post_status( 'unpaid', array(
'label' => _x( 'Pending', 'Order status', 'woocommerce' ),
'public' => true,
'exclude_from_search' => false,
'show_in_admin_all_list' => true,
'show_in_admin_status_list' => true,
'label_count' => _n_noop( 'Pending <span class="count">(%s)</span>', 'Pending <span class="count">(%s)</span>', 'woocommerce' )
) );
register_post_status( 'processing', array(
'label' => _x( 'Processing', 'Order status', 'woocommerce' ),
'public' => true,
'exclude_from_search' => false,
'show_in_admin_all_list' => true,
'show_in_admin_status_list' => true,
'label_count' => _n_noop( 'Processing <span class="count">(%s)</span>', 'Processing <span class="count">(%s)</span>', 'woocommerce' )
) );
register_post_status( 'on-hold', array(
'label' => _x( 'On Hold', 'Order status', 'woocommerce' ),
'public' => true,
'exclude_from_search' => false,
'show_in_admin_all_list' => true,
'show_in_admin_status_list' => true,
'label_count' => _n_noop( 'On Hold <span class="count">(%s)</span>', 'On Hold <span class="count">(%s)</span>', 'woocommerce' )
) );
register_post_status( 'complete', array(
'label' => _x( 'Complete', 'Order status', 'woocommerce' ),
'public' => true,
'exclude_from_search' => false,
'show_in_admin_all_list' => true,
'show_in_admin_status_list' => true,
'label_count' => _n_noop( 'Complete <span class="count">(%s)</span>', 'Complete <span class="count">(%s)</span>', 'woocommerce' )
) );
register_post_status( 'cancelled', array(
'label' => _x( 'Cancelled', 'Order status', 'woocommerce' ),
'public' => true,
'exclude_from_search' => false,
'show_in_admin_all_list' => true,
'show_in_admin_status_list' => true,
'label_count' => _n_noop( 'Cancelled <span class="count">(%s)</span>', 'Cancelled <span class="count">(%s)</span>', 'woocommerce' )
) );
register_post_status( 'refunded', array(
'label' => _x( 'Refunded', 'Order status', 'woocommerce' ),
'public' => true,
'exclude_from_search' => false,
'show_in_admin_all_list' => true,
'show_in_admin_status_list' => true,
'label_count' => _n_noop( 'Refunded <span class="count">(%s)</span>', 'Refunded <span class="count">(%s)</span>', 'woocommerce' )
) );
}
}
WC_Post_types::init();