This snippet will automatically complete orders for all virtual/downloadable products.
For MyListing websites, orders placed under a Listing Package are considered a virtual product, and the same goes for Listing Subscription Packages.
The question “Why are all my orders stuck with processing status?” comes up quite often. While it’s perfectly fine to leave MyListing orders with a “processing” status, some website owners like to see those orders as “completed.”
add_action( 'woocommerce_thankyou', 'custom_woocommerce_auto_complete_order' );
function custom_woocommerce_auto_complete_order( $order_id ) {
if ( ! $order_id ) {
return;
}
$order = wc_get_order( $order_id );
$order->update_status( 'completed' );
}