I've used the following code which works fine, it makes all orders default status to be on hold.
/**
* Auto Complete all WooCommerce orders.
*/
add_action( 'woocommerce_thankyou', 'custom_woocommerce_auto_complete_order' );
function custom_woocommerce_auto_complete_order( $order_id ) {
if ( ! $order_id ) {
return;
}
$order = wc_get_order( $order_id );
$order->update_status( 'on-hold' );
}
But I need to combine this with shipping/billing address. i.e. execute this code Only if the order's shipping or billing address is NOT UK or France. Customers from all other countries will be placed on hold as per this code, while UK & France orders get the default order status set by the payment geteway's settings.
Any help will be much appreciated.