In WooCommerce, the default behavior is to mark orders directly as “Completed” if all the order items are downloadable or virtual. However, if the order contains physical products or items that require manual processing, the order status is set to “Processing” until manually changed to “Completed” by the store administrator. While this workflow may suit many online stores, there are instances where automatically setting processing orders to “Completed” is preferred for streamlining order fulfillment.

The Importance of Forcing Processing Orders to Completed

For some online stores, the manual step of changing processing orders to completed may not be necessary. This additional step in the order fulfillment process can be time-consuming and may lead to delays in updating order statuses. By automatically setting processing orders to completed, store owners can streamline their order management workflow, reduce manual intervention, and ensure timely order completion.

Solution: Force Processing Orders to Completed

To force processing orders to completed status in WooCommerce, we can utilize a simple code snippet. This snippet overrides the default behavior and automatically sets processing orders to completed, eliminating the need for manual intervention.

add_filter( 'woocommerce_payment_complete_order_status', 'wc_force_procecssing_orders_to_completed', 100, 3 );

/**
 * Force Processing Orders to completed status.
 *
 * @param string $order_status
 * @param int $order_id
 * @param \WC_Order $order
 * @return string
 */
function wc_force_procecssing_orders_to_completed( $order_status, $order_id, $order ) {
	$order_status = 'completed';
	return $order_status;
}

How to Use the Snippet Code

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.