Bucheron
Bucheron

Reputation: 55

Set every new order with woocommerce on hold

For a specific woocommerce project, I need to set every new order on hold. It needs to go through that before processing payment.

Do you guys know a hook to do that? I tried many different things, that didn't work.

Upvotes: 0

Views: 1666

Answers (1)

Aibrean
Aibrean

Reputation: 6422

add_action( 'woocommerce_thankyou', 'custom_woocommerce_auto_complete_order' );
function custom_woocommerce_auto_complete_order( $order_id ) {
    global $woocommerce;
     if ( !$order_id )
        return;
    $order = new WC_Order( $order_id );
    $order->update_status( 'on-hold' );
}

This is the standard way of doing it. Not sure if it still works with 2.2, but you didn't specify your WooCommerce version.

Upvotes: 2

Related Questions