From 127bcc7d3510179a90a0de1f80e57c47fa76864b Mon Sep 17 00:00:00 2001 From: Mike Jolley Date: Fri, 30 May 2014 15:24:53 +0100 Subject: [PATCH] Register statuses for orders --- includes/class-wc-post-types.php | 55 ++++++++++++++++++++++++++++++++ 1 file changed, 55 insertions(+) diff --git a/includes/class-wc-post-types.php b/includes/class-wc-post-types.php index fa2cec29217..0783400b0e9 100644 --- a/includes/class-wc-post-types.php +++ b/includes/class-wc-post-types.php @@ -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 (%s)', 'Pending (%s)', '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 (%s)', 'Processing (%s)', '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 (%s)', 'On Hold (%s)', '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 (%s)', 'Complete (%s)', '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 (%s)', 'Cancelled (%s)', '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 (%s)', 'Refunded (%s)', 'woocommerce' ) + ) ); + } } WC_Post_types::init();