Mika MAtikainen

Apr 15, 2020 · 4 min read

How to Change Add New Orders Status in WooCommerce?



<?php /* * Add a new custom product tab. 
* Replace "Status Name" by your new order status name. */ 
function wp_code_snippets_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 (%s)', 'Status names (%s)', 'textdomain' )
	) );
	
}

add_action( 'init', 'wp_code_snippets_new_order_statuses' );

// Register in wc_order_statuses.
function wp_code_snippets_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', 'wp_code_snippets_new_wc_order_statuses' );

?>

Subscribe To Our Newsletter

Join our mailing list to receive the latest news and updates from our team.

You have Successfully Subscribed!

Share This