Want to reassure customers about the status of their order and provide them with information about what to expect next? This code will let you replace the default order status from on-hold to Processing once an order is completed on the admin side and change the default text shown on the Order received page.
add_action('woocommerce_thankyou', 'ts_update_order_status_and_display_message', 10, 1); function ts_update_order_status_and_display_message($order_id) { $order = wc_get_order($order_id); // Change the order status to processing $order->update_status('processing'); // Display the custom message on the Thank You page $custom_status_messages = array( 'wc-processing' => __('Thank you! Your order is now being processed.', 'woocommerce'), ); $order_status = $order->get_status(); if (array_key_exists($order_status, $custom_status_messages)) { wc_add_notice($custom_status_messages[$order_status], 'success'); } } add_filter('woocommerce_thankyou_order_received_text', 'ts_woo_change_order_received_text', 10, 2); function ts_woo_change_order_received_text($str, $order) { // Empty string to remove the default message $new_str = ''; $new_str .= ' Thank you! Your order is now being processed. We have emailed the purchase receipt to you.'; return $new_str; }
Output
Once an order is completed the order status gets changed to processing and the default message is being replaced with the new message as shown below. This customized message is displayed only for the orders which are in the processing stage.
When an order is completed the status is set to ‘on-hold’. In such cases, this default text is usually shown on the order received page.
Here, we have changed the status from on-hold to Processing and shown the relevant text on the Thank you page in WooCommerce. On the other hand, you can also automatically complete WooCommerce orders when they go to the processing status.