I am trying to auto complete order statuses for orders whose status is either pending or on hold. but the function is not working
add_filter( 'woocommerce_payment_complete_order_status', 'test_wc_autocomplete_paid_orders' );
function test_wc_autocomplete_paid_orders( $order_status, $order_id ) {
$order = wc_get_order( $order_id );
if ( $order_status == 'processing' && ( $order->status == 'on-hold' || $order->status == 'pending') ) {
return 'completed';
}
return $order_status;
}
it is for payment through banks through stripe.
I tried woocommerce_thankyou action also. but still not working.
what I am doing wrong? it is for stripe sofort transfer.
thanks