0

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.

Kara
  • 6,115
  • 16
  • 50
  • 57
Bucheron
  • 55
  • 10

1 Answers1

2
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.

Aibrean
  • 6,297
  • 1
  • 22
  • 38