Walmart (NYSE:WMT) is the world's biggest retailer, so it had a unique perspective into how shopping patterns changed as COVID-19 containment measures spread across the country. The overall sales impact was positive for the business, even though expenses surged in categories like labor, cleaning and sanitation, and digital fulfillment.

In a conference call with Wall Street analysts, Walmart detailed the huge spending shifts that executives noticed this quarter, which often varied dramatically by week. They broke down into a few clear stages of pandemic-driven demand.

Let's take a closer look.

A woman wearing a mask holding a grocery bag full of essentials.

Image source: Getty Images.

Stage 1: Staying safe

Walmart first noticed surging demand for consumer staples like groceries, paper goods, and surface cleaners. The shift toward home cooking and cleaning was massive as shoppers prepared for what was likely to be weeks of shelter-in-place recommendations. "For many of these [staple] items," CEO Doug McMillon said, "we were selling in two or three hours what we normally sell in two or three days."

Staple food suppliers like Campbell Soup benefited from this move, as did cleaning supply specialists like Clorox and Procter & Gamble. The safety theme also showed up in Walmart's declining customer traffic and its surging average spending per visit.

Stage 2: Finding entertainment

After essential needs were met, demand shifted toward entertainment, home exercise, and home improvement. "Puzzles and video games took off" at this time, McMillon said. Walmart sold out of bicycles and had trouble stocking enough home exercise equipment.

The chain experienced especially strong demand for games with educational aspects, which are sold by Hasbro and its peers. These products helped parents deal with new responsibilities in educating and entertaining their children.

Stage 3: Investing in the home

The next stage involved projects and shopping aimed at improving the home, where much more time was being spent by the entire family. "We could see customers looking to improve their indoor and outdoor living spaces," management said.

Walmart noted soaring demand in its home category, which includes furnishings and decorations. Rivals in this space, notably Wayfair (NYSE:W), observed a similar spike. Other big winners in this shopping phase include Lowe's (NYSE:LOW), which just reported double-digit first-quarter sales growth.

Stage 4: Splurging

The final pandemic shopping surge could be called the "indulgence" phase. It was supported by a few factors, including the arrival of federal stimulus checks and the fact that significant portions of a typical home budget -- like allocations for gasoline, entertainment, and restaurant spending -- had all disappeared for several weeks. Many consumers found themselves with extra cash burning in their pockets.

A delivery man drops of several boxes.

Image source: Getty Images.

"Discretionary categories really popped toward the end of the quarter," McMillon said, as Walmart sold things like televisions, apparel, sporting goods, and toys. "Call it relief spending," management explained.

Other winners in this niche presumably include Costco (NASDAQ:COST), which is set to report its earnings results on May 28 and typically sells a lot of discretionary products.

Meanwhile, the big demand shifts are causing extra logistical challenges and expenses for Walmart, which reported a 6% inventory decline that created many out-of-stock situations in Q1. The chain also had to mark down products, especially seasonal apparel, that missed their demand windows.

But overall, the retailer responded quickly enough to unprecedented pressures and opportunities through the early weeks of COVID-19's global spread. That success left Walmart in a position to -- almost always -- deliver what its customers have needed and wanted since mid-March.