• Resolved xps20

    (@corneliusw)


    I understand how to update order status via function.php for cash on delivery payments from processing to pending payment. The code for that is below:

    function   QuadLayers_change_order_status( $order_id ) {  
                    if ( ! $order_id ) {return;}            
                    $order = wc_get_order( $order_id );
                    if( 'processing'== $order->get_status() ) {
                        $order->update_status( 'wc-pending-payment' );
                    }
    }
    add_action('woocommerce_thankyou','QuadLayers_change_order_status');

    What I am looking for is to override WooCommerce default status whenever a customer checksout for the first action to trigger is Pending Payment. With that edited code above it’s the second action, as it only changes all orders from Processing when form is submitted to Pending Payment.

    I need this change because I am using a wallet balance to checkout for digital items. Customers are using cash on delivery payment method with P2P app Venmo/Cash App/Zelle to add a balance to their wallet. With the above code customers do not have to send me any payment for their wallet balance to increase because WooCommerce default nature is to mark all orders as Processing once checkout form is submitted. This is why I need for the default action (not a redirection) to be Pending Payment. That way once I can physically see for myself that the customer sent me the money via P2P app, I can then approve their order which in return will show their new wallet balance.

Viewing 3 replies - 1 through 3 (of 3 total)
  • Hey @corneliusw,

    With the above code customers do not have to send me any payment for their wallet balance to increase because WooCommerce default nature is to mark all orders as Processing once checkout form is submitted.

    I wanted to clarify this just a bit. The cash on delivery payment method will set orders to processing automatically at checkout. The idea behind “processing” is the order is ready to ship. Since the customer pays when they receive the order with COD processing is used.

    If you want these orders to stay on pending payment, I would suggest switching to the Check payment gateway. You could update the title/description to fit what you’re doing but that would take care of the status updates. Does that make sense?

    Let me know if you have something else in mind and we’ll go from there.

    Thanks!

    Thread Starter xps20

    (@corneliusw)

    I was able to figure it out. Working code:

    add_filter( 'woocommerce_cod_process_payment_order_status', 'change_cod_payment_order_status', 10, 2 );
    function change_cod_payment_order_status( $order_status, $order ) {
        return 'on-hold';
    }

    Glad to hear it worked you figured it out! Thanks for sharing the code with everybody.

    I’ll mark this thread as resolved now. If you have any further questions, I recommend creating a new one.

    Cheers!

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Change cash on delivery order status to pending payment’ is closed to new replies.