WC_Post_Types::register_post_statuspublic staticWC 1.0

Register our custom post statuses, used for order status.

Method of the class: WC_Post_Types{}

Returns

null. Nothing (null).

Usage

$result = WC_Post_Types::register_post_status();

WC_Post_Types::register_post_status() code WC 10.3.6

public static function register_post_status() {

	$order_statuses = apply_filters(
		'woocommerce_register_shop_order_post_statuses',
		array(
			OrderInternalStatus::PENDING    => array(
				'label'                     => _x( 'Pending payment', 'Order status', 'woocommerce' ),
				'public'                    => false,
				'exclude_from_search'       => false,
				'show_in_admin_all_list'    => true,
				'show_in_admin_status_list' => true,
				/* translators: %s: number of orders */
				'label_count'               => _n_noop( 'Pending payment <span class="count">(%s)</span>', 'Pending payment <span class="count">(%s)</span>', 'woocommerce' ),
			),
			OrderInternalStatus::PROCESSING => array(
				'label'                     => _x( 'Processing', 'Order status', 'woocommerce' ),
				'public'                    => false,
				'exclude_from_search'       => false,
				'show_in_admin_all_list'    => true,
				'show_in_admin_status_list' => true,
				/* translators: %s: number of orders */
				'label_count'               => _n_noop( 'Processing <span class="count">(%s)</span>', 'Processing <span class="count">(%s)</span>', 'woocommerce' ),
			),
			OrderInternalStatus::ON_HOLD    => array(
				'label'                     => _x( 'On hold', 'Order status', 'woocommerce' ),
				'public'                    => false,
				'exclude_from_search'       => false,
				'show_in_admin_all_list'    => true,
				'show_in_admin_status_list' => true,
				/* translators: %s: number of orders */
				'label_count'               => _n_noop( 'On hold <span class="count">(%s)</span>', 'On hold <span class="count">(%s)</span>', 'woocommerce' ),
			),
			OrderInternalStatus::COMPLETED  => array(
				'label'                     => _x( 'Completed', 'Order status', 'woocommerce' ),
				'public'                    => false,
				'exclude_from_search'       => false,
				'show_in_admin_all_list'    => true,
				'show_in_admin_status_list' => true,
				/* translators: %s: number of orders */
				'label_count'               => _n_noop( 'Completed <span class="count">(%s)</span>', 'Completed <span class="count">(%s)</span>', 'woocommerce' ),
			),
			OrderInternalStatus::CANCELLED  => array(
				'label'                     => _x( 'Cancelled', 'Order status', 'woocommerce' ),
				'public'                    => false,
				'exclude_from_search'       => false,
				'show_in_admin_all_list'    => true,
				'show_in_admin_status_list' => true,
				/* translators: %s: number of orders */
				'label_count'               => _n_noop( 'Cancelled <span class="count">(%s)</span>', 'Cancelled <span class="count">(%s)</span>', 'woocommerce' ),
			),
			OrderInternalStatus::REFUNDED   => array(
				'label'                     => _x( 'Refunded', 'Order status', 'woocommerce' ),
				'public'                    => false,
				'exclude_from_search'       => false,
				'show_in_admin_all_list'    => true,
				'show_in_admin_status_list' => true,
				/* translators: %s: number of orders */
				'label_count'               => _n_noop( 'Refunded <span class="count">(%s)</span>', 'Refunded <span class="count">(%s)</span>', 'woocommerce' ),
			),
			OrderInternalStatus::FAILED     => array(
				'label'                     => _x( 'Failed', 'Order status', 'woocommerce' ),
				'public'                    => false,
				'exclude_from_search'       => false,
				'show_in_admin_all_list'    => true,
				'show_in_admin_status_list' => true,
				/* translators: %s: number of orders */
				'label_count'               => _n_noop( 'Failed <span class="count">(%s)</span>', 'Failed <span class="count">(%s)</span>', 'woocommerce' ),
			),
		)
	);

	foreach ( $order_statuses as $order_status => $values ) {
		register_post_status( $order_status, $values );
	}
}