• Resolved sujitkumar87

    (@sujitkumar87)


    hey there,
    I need to set order status to ‘on-hold’ when a customer buys a product even after a successful transaction or on COD(cash on delivery).

    Thanks

Viewing 1 replies (of 1 total)
  • Thread Starter sujitkumar87

    (@sujitkumar87)

    I got a solution from stack overflow.

    add_action( 'woocommerce_thankyou', 'custom_woocommerce_auto_complete_order' );
    function custom_woocommerce_auto_complete_order( $order_id ) {
        global $woocommerce;
         if ( !$order_id )
            return;
        $order = new WC_Order( $order_id );
        $order->update_status( 'on-hold' );
    }


    Thanks

    • This reply was modified 6 years, 4 months ago by sujitkumar87.
Viewing 1 replies (of 1 total)
  • The topic ‘how to set every incoming order status to ‘on-hold’’ is closed to new replies.