As an admin of an online store, do you want to identify the orders distinctly that has order notes included by the customers? You can do it either with the default WooCommerce order statuses or create a new custom status as like shown in this post.
Solution 1: Change WooCommerce Order Status to a Default Order Status for Orders with Order Notes
The code will replace the default status ‘pending’ to ‘Review Order Notes’ when the order contains a customer order notes.
add_action( 'woocommerce_thankyou', 'ts_change_order_status' ); function ts_change_order_status( $order_id ){ if( ! $order_id ) return; $order = wc_get_order( $order_id ); if ($order->get_customer_note()){ // Update order status to 'pending' if there are customer notes $order->update_status( 'pending' ); // No need for "wc-" prefix } } add_filter( 'wc_order_statuses', 'ts_rename_order_status_msg', 20, 1 ); function ts_rename_order_status_msg( $order_statuses ) { // Change the label for 'pending' status to 'Order Notes' $order_statuses['wc-pending'] = _x( ' Review Order Notes', 'Order status', 'woocommerce' ); return $order_statuses; }
Output
This code looks for any special notes in a new order. If it finds any, it changes the order status to ‘pending’ and label it as ‘Review Order Notes’, a default status in WooCommerce.
Solution 2: Change WooCommerce Order Status to a Custom Status for Orders with Order Notes
The code will set the custom order status ‘Review Order Notes’ when a customer leaves a note on their order.
function ts_register_order_notes_status() { register_post_status( 'wc-order-notes', array( 'label' => 'Order Notes', 'public' => true, 'show_in_admin_status_list' => true, 'show_in_admin_all_list' => true, 'exclude_from_search' => false, 'label_count' => _n_noop( 'Order Notes <span class="count">(%s)</span>', 'Order Notes <span class="count">(%s)</span>' ) ) ); } add_action( 'init', 'ts_register_order_notes_status' ); function ts_add_order_notes_statuses( $order_statuses ) { $new_order_statuses = array(); foreach ( $order_statuses as $key => $status ) { $new_order_statuses[ $key ] = $status; if ( 'wc-processing' === $key ) { $new_order_statuses['wc-order-notes'] = 'Order Notes'; } } return $new_order_statuses; } add_filter( 'wc_order_statuses', 'ts_add_order_notes_statuses' ); add_action( 'woocommerce_thankyou', 'ts_change_order_status' ); function ts_change_order_status( $order_id ){ if( ! $order_id ) return; $order = wc_get_order( $order_id ); if ($order->get_customer_note()){ // Update order status to 'wc-order-notes' if there are customer notes $order->update_status( 'wc-order-notes' ); } } add_filter( 'wc_order_statuses', 'ts_rename_order_status_msg', 20, 1 ); function ts_rename_order_status_msg( $order_statuses ) { // Change the label for 'wc-order-notes' status to 'Review Order Notes' $order_statuses['wc-order-notes'] = _x( 'Review Order Notes', 'Order status', 'woocommerce' ); return $order_statuses; }
Output
We have created a custom order status ‘Order Notes’ and set the label name as ‘Review Order Notes’. You can see it added to the list of the Status dropdown in the image given below.
Whenever a new order is placed the code checks for the presence of special notes associated with the order. If it has special notes, then the order status will be set to ‘Review Order Notes’ which is one of the custom order statuses created.
Likewise, you can also change the label and rename the order status messages in WooCommerce that is displayed in the Status column of the orders table.