• Resolved Mikey

    (@mikeyhash)


    Hi @subratamal,

    By default, if someone pays in full with Wallet cash, the status of the order is automatically set as “Processing”.

    I want to change this default so as the order status to be automatically set as “On-Hold” when the order is placed and paid in full with cash from Wallet.

    Can you please at least show me the way on how to achieve this? I wasn’t able to find the proper file to be modified.

    Many thanks!

Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Author Subrata Mal

    (@subratamal)

    Hi @mikeyhash,

    Please use below code to theme function.php file.

    add_filter('woocommerce_payment_complete_order_status', 'woocommerce_payment_complete_order_status_callback');
    function woocommerce_payment_complete_order_status_callback($status, $order_id){
        $order = wc_get_order($order_id);
        if('wallet' === $order->get_payment_method('edit')){
            $status = 'on-hold';
        }
        return $status;
    }
    Thread Starter Mikey

    (@mikeyhash)

    Wow, thank you for the super quick response, @subratamal.

    I have used the code you gave me in the functions.php file and it seems to work, but there is an issue and I hope there is a quick fix to it.

    So, when I place an order (paying in full with Wallet) I receive an Internal Error pop-up (please see http://prntscr.com/k6roul) and I am not redirected to the “order successfully made” details page.

    It’s odd, because the order is actually made, I can see it in wp-admin dashboard and it is On-Hold by default, as requested. However, the buyer receives this internal error, even though the order is also registered in his “Orders” dashboard.

    Oh, and also, it appears that the WC email for on-hold order was NOT triggered and sent to the customer.

    Any fixes?

    I super thank you!

    • This reply was modified 7 years, 10 months ago by Mikey.
    Thread Starter Mikey

    (@mikeyhash)

    @subratamal,

    Actually, it is not ok, I just noticed. It sets the order to “Pending Payment”, not “On-hold”. And also the internal error is still there.

    Please help.

    Best regards,
    Mikey

    Plugin Author Subrata Mal

    (@subratamal)

    Hi @mikeyhash,

    So sorry please use this updated code.

    add_filter('woocommerce_payment_complete_order_status', 'woocommerce_payment_complete_order_status_callback', 100, 2);
    function woocommerce_payment_complete_order_status_callback($status, $order_id){
        $order = wc_get_order($order_id);
        if('wallet' === $order->get_payment_method('edit')){
            $status = 'on-hold';
        }
        return $status;
    }

    Thank you.

    Thread Starter Mikey

    (@mikeyhash)

    @subratamal, you’re awesome! It works perfectly now. Can’t thank you enough.

Viewing 5 replies - 1 through 5 (of 5 total)

The topic ‘Full payment with Wallet -> Order status “on-hold”’ is closed to new replies.