I don't want Woocommerce to automatically update the order status from "Paused" to "Completed". I would like it to remain "on hold" as we are sending replacement items and waiting for the original items to be returned to us. Basically, I want to set it to "on hold" even after the item has been shipped. Is there any way to achieve this?
I tried using the following code without success:
add_action( 'woocommerce_payment_complete', 'cancel_completed_status' ); function cancel_completed_status( $order_id ){ $order = wc_get_order( $order_id ); $items = $order->get_items(); foreach ( $items as $item_id => $item ) { $product_id = $item->get_variation_id() ? $item->get_variation_id() : $item->get_product_id(); if ( $order->has_status( 'on-hold' )) { $order->update_status( 'on-hold' ); $order->save(); } } }