Order Status Automatically Changes From “on Hold” To “processing”

[Solved] Order Status Automatically Changes From “on Hold” To “processing” | Perl - Code Explorer | yomemimo.com
Question : order status automatically changes from “On hold” to “processing”

Answered by : shahzadraza

add_action('woocommerce_order_status_changed', 'ts_auto_complete_by_payment_method');
function ts_auto_complete_by_payment_method($order_id)
{
if ( ! $order_id ) {
return;
}
global $product;
$order = wc_get_order( $order_id );
if ($order->data['status'] == 'on-hold') {
$payment_method=$order->get_payment_method();
if ($payment_method!="COD") // change payment method
{
$order->update_status( 'processing' );
}}}

Source : https://stackoverflow.com/questions/48917022/auto-change-order-status-from-hold-on-to-processing-in-woocommerce | Last Update : Tue, 07 Dec 21

Question : order status automatically changes from “On hold” to “processing”

Answered by : shahzadraza

add_action( 'woocommerce_thankyou', 'woocommerce_auto_processing_orders');
function woocommerce_auto_processing_orders( $order_id ) { if ( ! $order_id ) return; $order = wc_get_order( $order_id ); // If order is "on-hold" update status to "processing" if( $order->has_status( 'on-hold' ) ) { $order->update_status( 'processing' ); }
}

Source : https://stackoverflow.com/questions/48917022/auto-change-order-status-from-hold-on-to-processing-in-woocommerce | Last Update : Tue, 07 Dec 21

Answers related to order status automatically changes from “on hold” to “processing”

Code Explorer Popular Question For Perl