• My credit card gateway automatically captures the payment when the order is placed. By default, WooCommerce then marks the order as Processing. I need to prevent it from skipping over On Hold due to our order workflow. How can you prevent WooCommerce from automatically going to Processing (so the order is received, payment captured, but the order status stays at On Hold)? I tried the snippet below but that results in the order updating to Payment Pending instead of On Hold:

    add_action( ‘woocommerce_thankyou’, ‘stop_auto_complete_order’ );
    function stop_auto_complete_order( $order_id ) {
    if ( ! $order_id ) {
    return;
    }

    $order = wc_get_order( $order_id );
    $order->update_status( ‘on_hold’ );
    }

Viewing 3 replies - 1 through 3 (of 3 total)
  • Rynald0s

    (@rynald0s)

    Automattic Happiness Engineer

    Hi @alphadesigndev!

    You need to replace on_hold with on-hold

    Cheers!

    Thread Starter alphadesigndev

    (@alphadesigndev)

    I corrected the slug but the order still goes to Processing before being changed back to On Hold. This creates a problem because the temporary Processing status triggers our order processing email to be sent. This email notifies the customer that their order is ready for pickup when it has only been received. Can we adjust the function I provided previously to prevent this intermediate step?

    I was able to prevent this from happening with Cash on Delivery orders using the following function:

    // change COD payment method order status from processing to on-hold
    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’;
    }

    Is it possible to adapt this to my Elavon CC gateway or to have it apply to ALL orders/payment gateways?

    Thread Starter alphadesigndev

    (@alphadesigndev)

    With the original function, the order goes through the following process:

    1) Order received – status set to Payment Pending
    2) status changes from Payment Pending to Processing (for only a moment)
    3) status changes from Processing to On Hold

    Step 2 is causing confusion with our customers because they receive an email saying their order is ready for pickup before they receive the order received (On Hold) email.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Prevent orders from processing automatically’ is closed to new replies.