in my desire of solution, i fond some piece of code then if your poroducts are “virtual”, check this :
<?php
/*
* Plugin Name: Autocomplete virtual product
* Plugin URI: https://rd-graphisme.com
* Description: Change order status of virtual product after confirmation of pay
* Version: 0.1
* Author: RD Graphisme
* Author URI: https://rd-graphisme.com
* Copyright: (c) 2019 RD GRAPHISME
* License: GNU General Public License v2.0
* License URI: https://www.gnu.org/licenses/gpl-2.0.html
* Text Domain: autocomplete virtual product for WC
*/
add_action('woocommerce_order_status_changed', 'ts_auto_complete_virtual');
function ts_auto_complete_virtual($order_id)
{
if ( ! $order_id ) {
return;
}
global $product;
$order = wc_get_order( $order_id );
if ($order->data['status'] == 'processing') {
$virtual_order = null;
if ( count( $order->get_items() ) > 0 ) {
foreach( $order->get_items() as $item ) {
if ( 'line_item' == $item['type'] ) {
$_product = $order->get_product_from_item( $item );
if ( ! $_product->is_virtual() ) {
// once we find one non-virtual product, break out of the loop
$virtual_order = false;
break;
}
else {
$virtual_order = true;
}
}
}
}
// if all are virtual products, mark as completed
if ( $virtual_order ) {
$order->update_status( 'completed' );
}
}
}
Put this in noetpadd++ and save as php
Put in plugins folder
Activate… and normally it work.
Cheers