I’ve tried the below code to create custom status.
add_action( 'init', function() {
$term = get_term_by( 'name', 'shipped', 'shop_order_status' );
if ( ! $term ) {
wp_insert_term( 'shipped', 'shop_order_status' );
}
} );
But it is not working. I tried some other methods also. Please can anyone help me on this..
You need to first register your custom status and then add it to the order statuses array.