Some stores do have their stock available online. I know Home Depot does. The website tells you what aisle the item is in, which rack in that aisle, and how many they have.
I've also seen where stores won't have it at the store I have selected, but it will also check the stock of nearby stores to tell me of one of those other stores have it.
It's not ubiquitous yet, but I'm seeing it more and more. I've also found with things like Apple Pay that checkout on random online stores is just as fast and easy as Amazon, which is quite nice.