By default, WooCommerce assigns order statuses based on the payment method used, such as “Processing” for successful online payments and “On hold” for bank transfers. However, there are situations where you might want more control over how orders are handled, for example, to ensure orders paid via specific gateways are marked as “Completed” or “Pending” for easier management.
In this guide, we’ll show you how to automatically set the default order status based on the payment gateway selected at checkout. This customisation can help streamline your operations and improve your overall workflow. As always, remember to use a child theme when making changes to your functions.php file, so your edits are protected during theme updates.
Why Customise the Default Order Status by Payment Gateway?
Customising the default order status per payment gateway offers several advantages:
- Improved Workflow: Automatically assign statuses like “Pending” or “On Hold” for gateways like bank transfers, and “Completed” for instant payments like PayPal or credit cards.
- Better Communication: Ensures that customers receive the correct order status notifications depending on how they pay.
- Easier Management: Simplifies the back-end order management, especially for stores with a variety of payment gateways.
Custom Code to Set Default Order Status by Payment Gateway
Here’s how you can use a custom function to set the default order status based on the payment gateway. Add this code to your theme’s functions.php file or a child theme.
/*
* Snippet: How to Set the Default Order Status Based on Payment Gateway in WooCommerce – 2026
* Author: John Cook
* URL: https://wcsuccessacademy.com/?p=1532
* Tested with WooCommerce 10.7.0
* "This function sets the default order status based on the selected payment gateway in WooCommerce"
*/
function wcsuccess_set_order_status_by_payment_gateway( $order_id ) {
if ( !$order_id ) return;
// Get the order object
$order = wc_get_order( $order_id );
$payment_method = $order->get_payment_method(); // Get the payment method used
// Define the default status for each payment gateway
switch( $payment_method ) {
case 'bacs': // Bank Transfer
$order->update_status( 'on-hold', __( 'Order placed via bank transfer, awaiting payment.', 'woocommerce' ) );
break;
case 'cheque': // Cheque Payment
$order->update_status( 'on-hold', __( 'Order placed via cheque, awaiting clearance.', 'woocommerce' ) );
break;
case 'paypal': // PayPal Payment
$order->update_status( 'completed', __( 'Payment made via PayPal. Order marked as complete.', 'woocommerce' ) );
break;
case 'cod': // Cash on Delivery
$order->update_status( 'processing', __( 'Order placed via Cash on Delivery, awaiting fulfilment.', 'woocommerce' ) );
break;
default: // Default behaviour for other gateways
$order->update_status( 'processing', __( 'Payment received, processing order.', 'woocommerce' ) );
break;
}
}
add_action( 'woocommerce_thankyou', 'wcsuccess_set_order_status_by_payment_gateway' );
Understanding the Code
- Payment Method Check: The code uses the
get_payment_method()function to retrieve the payment gateway used by the customer during checkout. - Conditional Status Updates: Depending on the payment gateway (
bacsfor bank transfers,paypalfor PayPal, etc.), the order status is automatically updated to the appropriate status (e.g., “On hold,” “Completed,” or “Processing”). - Custom Messaging: The optional message argument provides context when the order status changes, such as awaiting payment or fulfilment.
Adding Custom Payment Gateways
If you’re using custom payment gateways, simply extend the switch statement to include the slug of your custom gateway, like this:
case 'my_custom_gateway': // Custom Payment Gateway
$order->update_status( 'completed', __( 'Order placed using custom gateway. Marked as complete.', 'woocommerce' ) );
break;
You can easily modify the default status and messaging to match your desired workflow.
Adding Shortcodes for Additional Customisation
You can also add dynamic content inside the status message using shortcodes. For example, if you want to include a custom message that changes based on the payment gateway, you can use the do_shortcode() function within the update_status() call.
$order->update_status( 'on-hold', do_shortcode('[your_custom_shortcode]') );
This allows you to dynamically include content, such as a thank you message, product details, or any shortcode-supported content within the order status updates.
Best Use Cases for Setting Default Order Status by Payment Gateway
- Bank Transfers: Set orders paid by bank transfer to “On hold” until the payment clears.
- Cash on Delivery: Mark orders as “Processing” so that they’re ready for fulfilment, but payment is collected on delivery.
- PayPal or Credit Cards: Automatically set orders to “Completed” for gateways that process payments immediately.
Conclusion
Customising the default order status based on payment gateways can help streamline your WooCommerce store’s order management process, ensuring that each order follows the appropriate workflow. By adding a few lines of code, you can ensure that orders paid via specific gateways receive the correct status, helping you manage payments and fulfilments more effectively.
Remember to test this customisation in a staging environment before applying it to your live store. Always use a child theme to avoid losing your customisations during theme updates. For more WooCommerce customisations, explore our WooCommerce Visual Hooks Guide and wp-config generator to enhance your store further.
I have been working with WordPress and WooCommerce since 2012 and have developed a deep knowledge of the content management system. Since 2012, I have developed several plugins and designed dozens of websites utilising different frameworks, CMS’s and programming languages. I am proficient in PHP, Python, Java, C, C++, R and JavaScript with limited experience in Go, Kotlin and Swift.
Educationally, I have a Master’s degree in cyber security a Bachelor’s (Hons, First Class) in Applied Research and a Graduate Certificate in Data Science. I’m currently undertaking PhD studies investigating IoT cybersecurity. I recently graduated with First Class Honours and Masters of Information Technology, receiving the Executive Dean’s Award for studies undertaken in the 2021 and 2022 academic years. I have worked in the information technology industry for the past 11 years primarily as a software/web developer specific to design, optimisation, network management and security. My research interests are in the areas of Internet of Things (IoT), 5G and Beyond Networks, information security for wireless networks and software development.
Stay In Touch

