On Tuesday, Walmart revealed that its sales jumped by almost 9% during its fiscal third quarter, indicating changing consumer habits. News of the impressive earnings release boosted the company’s share prices by roughly 7%.

The positive results were unexpected given that the United States is wrestling with historically high inflation and other economic obstacles.

Even though American pocketbooks are “stretched,” Walmart benefited as consumers opted to buy less-expensive products typically found at the hypermarket chain, the company’s Chief Financial Officer John David Rainey claimed.

Walmart also witnessed buying habit changes over the quarter, as consumers bought less apparel and fewer items in the home category. They are also increasingly waiting for sales before making purchases.

Shoppers are also making comprises, selecting cheaper proteins like hot dogs and beans instead of chicken and steak. When they are buying the same item, they are choosing more affordable alternatives, like generic diapers, over brand name labels.

“People have less discretionary income or less disposable income to spend on things — and so they’re looking for value,” explained Rainey.

The company also saw higher-income shoppers visiting the store. Roughly three-quarters of its gain in share of the food market came from households earning over $100,000 annually, a continuation of similar trends witnessed the quarter prior.

Regardless, Walmart continues to focus on its core consumer of budget-minded shoppers. To continue attracting these patrons amid high inflation, the company promoted a typical basket of Thanksgiving fare, like turkey and gravy, but kept the prices unchanged from last year.

“That’s a great example of how we can step up and absorb some of this to help families that need it most,” said Walmart CEO Doug McMillon on a call with investors.

Walmart’s earnings and revenue both beat Wall Street estimates. Earnings per share landed at $1.50 adjusted compared to the $1.32 expected.

Revenue similarly came in higher at $152.81 billion for the quarter versus expectations of $147.75 billion.

While the company posted a net loss of $1.8 billion in Q3, down from a profit of $3.11 billion during the same quarter last year, it included an over $3 billion nationwide settlement related to the lawsuit claiming Walmart was irresponsible in filling prescription opioid painkillers.

Walmart commented on the legal case, stating it “strongly disputes the allegations in these matters, and this settlement framework does not include any admission of liability.”

Back-to-school shopping also reportedly helped drive sales this past quarter in the United States and across its business lines globally.

Domestically, e-commerce sales rose 16% annually during the quarter and 24% over two years. With its online presence growing, the giant retailer saw its global advertising business expand, increasing over 30% annually last quarter.

While Walmart’s earnings news is mostly positive, it is cautiously optimistic about the upcoming shopping season. It expects sales to rise roughly 3% this holiday and earnings per share to fall upwards of 5%.

Regardless, the Q4 holiday season is “off to a pretty solid start,” said Rainey, but Walmart will be “watching sales closely up until the last minute of Christmas Eve,” he stressed.