What’s the best way to handle an order in a ecommerce website?

I'm developing an eCommerce website(using Symfony3 and mysql), and I need to know the best way to handle the checkout process.
The site will sell clothes and shoes and every item has a certain quantity. I'm particularly interested in things like what to do when an order can't be processed because one item is out of stock or the stock doesn't have the quantity ordered.
I have an idea about the implementation , but I need specialists' advice to do it the best way possible.