Answer the question
In order to leave comments, you need to log in
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
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 );
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question