I am trying use the filter woocommerce_payment_complete_order_status
. I have tried a lot of things, but I’m not able to get it to work.
function cod_to_onhold( $order_status, $order_id ) {
//global $woocommerce;
$order = new WC_Order($order_id);
return 'completed';
error_log("order marked completed", 0);
}
add_filter( 'woocommerce_payment_complete_order_status', 'cod_to_onhold', 10, 2 );