Walmart (WMT 1.03%) is the most popular stock in the consumer staples sector among billionaire investors, according to research by The Motley Fool. It's the top consumer staples company by market cap, beating out other giants in the category, such as Costco.
Investing in consumer staples stocks is attractive because the consistent demand for essential goods provides a stable earnings base for businesses in the sector, offering resilience to the current macroeconomic headwinds of tariffs and inflation.
But a new factor has driven Walmart stock's popularity through the roof. Shares hit an all-time high of $109.58 on Oct. 16 after the company announced a partnership with ChatGPT creator OpenAI. Let's dive into the company to evaluate whether now is the time to buy.
Image source: Getty Images.
Walmart's business amid an uncertain economic backdrop
As the leader in consumer staples, Walmart is well positioned to withstand current headwinds in the retail sector. This is demonstrated in the company's outstanding results for its fiscal second quarter ended July 31. Walmart's revenue was up 4.8% year over year to $177.4 billion.
Its sales growth demonstrates that Walmart is thriving in a tough economic environment. In fact, the company raised its revenue outlook for the 2026 fiscal year to a range between 3.8% to 4.8%.

NYSE: WMT
Key Data Points
Walmart's strengths beyond retail stores
Walmart's sales success helped its Q2 earnings per share (EPS) increase 57% to $0.88 from the prior year's $0.56. Contributing to this was the company's high-margin advertising business.
This is a relatively new area for the company. It wasn't until 2022 that Walmart revealed that it was making billions of dollars from ads, and in fiscal Q2, the advertising business grew 46% year over year.
But of particular significance to the retailer's deal with OpenAI is Walmart's e-commerce division, which grew global fiscal Q2 sales 25% year over year. This is an impressive showing, considering that it's battling tech titan Amazon in the space.
Walmart will provide OpenAI with e-commerce capabilities, while integrating ChatGPT into its website to facilitate online shopping. This could certainly boost Walmart's digital sales further, but existing investor excitement over all things related to artificial intelligence could have pushed Walmart stock's valuation too high.
To buy or not to buy Walmart stock
To evaluate if Walmart shares have gotten expensive, here is a look at its forward price-to-earnings (P/E) ratio, compared to competitors Costco and Amazon.
This metric reflects how much investors are willing to pay for a dollar's worth of earnings based on estimates for the next 12 months. The forward P/E multiple is useful because the upcoming holidays are a major sales season for these retailers.
Data by YCharts.
The chart shows that Walmart stock is the better value versus Costco, due to its lower forward P/E ratio. However, that's not the case against Amazon.
This is particularly telling, since Amazon is a high-growth tech company that notched a 13% year-over-year revenue increase in Q2 to $167.7 billion. That's more than double Walmart's 4.8% Q2 sales growth.
Although Walmart is an excellent company to invest in, the current valuation is on the pricey side, so the prudent approach would be to wait for the share price to drop before deciding to buy.
