If an online retailer is selling products worldwide, then it is a good practice to manage order statuses effectively. This will help store owners to quickly identify the order placed from a particular country and so they can act promptly.
This customization of changing the WooCommerce order status to a new status can be also done by creating a custom WoCommerce order status and assigning it to a specific billing country. But here we will look into updating the default status to the status that you prefer just by changing the label of the default status.
Solution: Change WooCommerce Order Status Based on Country
The code snippet will help to change the status of orders placed from a specific country such as ‘India’ to the status of ‘scheduled’.
add_action('woocommerce_order_status_changed', 'ts_change_status_by_country'); function ts_change_status_by_country($order_id) { if (!$order_id) { return; } // Get the order object $order = wc_get_order($order_id); // Get the billing country of the customer $billing_country = $order->get_billing_country(); // Check if the billing country is 'IN' (India) if ($billing_country == 'IN') { // If the billing country is not 'IN', update the order status to 'completed' $order->update_status('completed'); } } add_filter( 'wc_order_statuses', 'ts_rename_order_status_msg', 20, 1 ); function ts_rename_order_status_msg( $order_statuses ) { $order_statuses['wc-completed'] = _x( 'Scheduled', 'Order status', 'woocommerce' ); return $order_statuses; }
Output
When a customer places an order from the billing country of ‘India’ the order status immediately gets changed to ‘scheduled’ on the orders page of the admin.
![](https://www.tychesoftwares.com/wp-content/uploads/2024/04/Change-WooCommerce-Order-Status-based-on-Country-1024x490.png)
Customers from the country ‘India’ when viewing their orders on the front end will likely know that their orders are been ‘scheduled’.
![](https://www.tychesoftwares.com/wp-content/uploads/2024/04/order-status-scheduled-based-on-country-1024x355.png)
Alternatively, you can also change the status based on the payment method. I you need to explore more refert to this post that will automatically set the WooCommerce order status as Completed when they go to the processing status.