Allow different order status in woocommerce


sometimes it is necessary to add new order type, for example some of the items i sell requires installer confirmation. Thanks woocommerce, the hooks are easy to use. In your functions file:

// New order status - Waiting for Installer Response
function register_waiting_installer_order_status() {
  register_post_status( 'wc-waiting-installer', array(
    'label' => _x( 'Waiting for installer Response', '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( 'Waiting for installer response <span class="count">(%s)</span>', 'Pre Order <span class="count">(%s)</span>', 'textdomain' )
  ) );
}
  
add_action( 'init', 'register_waiting_installer_order_status' );

function waiting_for_installer_response_order_status($o) {
	$o['wc-waiting-installer'] = _x( 'Waiting for installer response', 'Order status', 'woocommerce' );
	return $o;
}

add_filter( 'wc_order_statuses', 'waiting_for_installer_response_order_status' );
Like it.? Share it:

Comments are closed.