D
D
DMax9212018-09-24 15:55:40
WooCommerce
DMax921, 2018-09-24 15:55:40

Change order status in Direct Bank Transfer, how to cancel?

Hello, friends! I set the standard payment method "Direct bank transfer" when the buyer selects this method and makes a purchase, in the admin panel, first the status is "Pending payment" and immediately changes to "On hold".
How can I make sure that this status does not change but is "Pending payment"?
Thanks in advance!

Answer the question

In order to leave comments, you need to log in

2 answer(s)
I
Igor Vorotnev, 2018-10-04
@HeadOnFire

WooCommerce has a woocommerce_thankyou_{payment_method} dynamic hook that fires after checkout. This allows you to target a specific payment method, as in your case:

function bacs_order_status( $order_id ) 
{
    $order = wc_get_order( $order_id );

    if ( in_array( $order->get_status(), [ 'on-hold', 'pending',  ] ) ) {
        $order->update_status( 'processing' );
    } else {
        return;
    }
}
add_action( 'woocommerce_thankyou_bacs', 'bacs_order_status', 10, 1 );

Change to the status you want.

M
Mofsy, 2018-10-04
@Mofsy

You need to write your own payment plugin, implementing the correct status in it.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question