- you're running a promotion
- the price changed in between the time the person added it to their shopping cart and checkout
- two people are processed for a payment on the last item in inventory at the same time
- there are different options on the item, e.g. color, that change the price
- other people bought the last item in inventory already, but there's an equivalent product at the same price
- the person bought the product using a combination of real money and gift card money, which the payment processor does not handle
- the person bought other things in the same transaction, e.g. a gift card, that do not have an inventory ID
Those are just a few cases off the top of my head, but the short end of it is that expressing all of this with a combination of SQL and client-side logic is just madness. If you're saying that we don't need to write business logic in PHP any more, I think you just don't work with the same constraints that most businesses do.