We discovered the last step of the WooCommerce checkout was very slow, taking about 20 seconds to complete. The orders eventually went through successfully. The hangup seemed to be on the ?wc-ajax=checkout stage of the checkout.
In our case the problem was happening with all sites hosted on InMotion VPS servers. We tested about 6 different sites, and even created a new one. It was happening on all of them, even a completely different VPS server. Other sites we tested on other hosts such as Siteground were not experiencing the issue.
It wasn’t the gateway, because it was doing it with just Pay By Check active.
It took almost 2 days to figure this out and we found very little information on the web about it. There were plenty of olders posts about it, but very few solutions.
The email sending was the next area of focus. It must be hanging up on this process. Turning off the main order notification emails, showed an improvement and brought down to 8-10 seconds. Better than 20, but still unacceptable. Deferring transactional emails entirely is what solved it for us, which processes the emails after the order is submitted. Adding this filter to the functions.php file resolved the issue.
Add this to your functions.php file.
add_filter('woocommerce_defer_transactional_emails', '__return_true' );