WooCommerce sets the order status to “Pending” for all new orders. While this may be suitable for some businesses, others may require a different default order status to better align with their workflow.

Fortunately, WooCommerce offers flexibility and customization options through filters, allowing you to tailor the platform to meet your specific needs. In this blog post, we’ll explore how you can easily change the default order status in WooCommerce using a simple filter.

While “Pending” is a common default status and works well for many businesses, there are scenarios where you might want to customize this status to better reflect your order processing workflow. For instance, you may prefer to set the default order status to “Processing” or “Completed” if you fulfill orders immediately upon receipt, or “On Hold” if you require additional verification before processing orders.

Changing the Default Order Status with a Filter

WooCommerce provides a convenient way to modify the default order status using the woocommerce_default_order_status filter. This filter allows you to specify a different default order status according to your preferences.

add_filter( 'woocommerce_default_order_status', 'custom_default_order_status' );

function custom_default_order_status( $status ) {
    // Change the default order status to 'Processing'
    return 'completed';
}

In this example, The default order status will be completed.

How to Use the Code snippet

You can implement this snippet by following on of these steps:

  1. Child Theme: If you’re using a custom child theme, you can add the snippet to the functions.php file of your child theme. This ensures that the functionality remains intact even when you update your theme.
  2. Custom Plugin: A better way, you can create a custom plugin to add the snippet. Creating a custom plugin allows you to keep your code separate from the theme files, making it easier to manage and maintain. You can use our online tool WP Plugin Creator to generate a custom plugin with the snippet included. Simply paste the snippet into the plugin code editor, specify the plugin name, and download the generated plugin zip file.