Online store owners would typically provide offers and discounts to encourage customers to buy more. This is one way to convert customers as repeated customers. Similarly, you can prioritize shipping processing based on order total and change the order status accordingly.
For instance, if the customer purchases for an amount of above $500 and you would prefer to do expedited shipping for such orders. To distinguish these orders from the admin side you can auomatically update the status of such orders to processing or anything else as per your wish.
Solution: Change WooCommerce Order Status Based on Order Total
The code snippet will help you to change the order status to ‘processing’ if the order total exceeds the maximum total amount of $500 as defined in the code.
add_action( 'woocommerce_thankyou', 'ts_auto_complete_processing_orders_based_on_total', 90, 1 ); function ts_auto_complete_processing_orders_based_on_total( $order_id ){ if( ! $order = wc_get_order( $order_id ) ){ return; } // HERE define the max total order amount $max_total_limit = 500; if( $order->has_status('on-hold') && $order->get_total() > $max_total_limit ){ $order->update_status( 'processing' ); } }
Output
When orders are placed, the code checks for the total order amount and the current status of the order. If the order total exceeds the threshold amount ($max_total_limit = 500;) and if the current status is on-hold it will be automatically changed to the ‘processing’ status.
In the same way, you can also change WooCommerce order status for orders placed from specific countries.