A decade ago you couldn’t find gluten-free anything.

Grocery stores aren’t just for your eggs and bread anymore.

The sheer number of food items has grown tremendously in the past two decades, said Michael Ruhlman, author of the new book “Grocery: The Buying and Selling of Food in America” (published by Abrams Press). Ruhlman, who has been writing about food and cooking for 20 years, decided to dive into the world of supermarkets, especially after his father — who loved grocery shopping — passed in 2008. He spent a lot of time at Heinen’s, a supermarket chain store in Cleveland, where he grew up, talking to employees and even bagging groceries.

Ruhlman took note of the many changes grocery stores have made to stay current, such as adding more packaged foods, and writes about how people shop these stores without giving much thought to it. There are 38,000 supermarkets in the U.S., and they bring in $650 billion a year, according to the Food Marketing Institute and the U.S. Bureau of Labor Statistics. Companies of all backgrounds are trying to tap into the pure necessity of grocery shopping, too — Costco COST, +0.41% recently expanded into grocery deliveries in Florida and Amazon AMZN, -0.07% has Amazon Fresh.

Shoppers can learn a lot by walking down the aisles of their supermarkets — not only to see the wide variety of new products available, but the conditions of the store. “Just look at the quality of produce. That shows how much the store cares about the rest of the stuff there,” he says. And keep in mind that a perfectly round apple doesn’t mean it’s the best apple: Some stores are trying to re-brand “ugly” fruits and vegetables since Americans throw out $165 billion worth of food every year.)

Ruhlman spoke with MarketWatch about how grocery stores have changed:

MarketWatch: What was the greatest takeaway for you from writing this book?

Michael Ruhlman: We’ve never had more…