Walmart (WMT  ) shares dropped more than 10% on the news that the company was cutting its outlook due to inflation resulting in consumers spending more on low-margin items like food and gas, while they were spending less on higher-margin, big-ticket items like electronics, appliances, and furniture.

However, shares rebounded to make up the losses over the next week as the stock market put together an impressive rally off the lows with the S&P 500 (SPY  ) up more than 12% from its mid-June lows. Equally interesting is that Walmart is considered a defensive stock which means that it tends to outperform in recessionary conditions.

And, this behavior is continuing despite retailers being one of the most affected sectors due to consumers changing their spending habits, excess inventories due to the 'bullwhip effect', and rapid increases in hiring and spending during the last 2 years. In fact, it could be argued that retailers drove a lot of the post-pandemic economy as they built new facilities to meet the rising demand for e-commerce. They also hired millions of warehouse workers at above-average wages which contributed to wage growth for wages on the lower end.

Now, we are on the other side of this trend, and retailers are struggling after nearly 3 years of outperformance and surging earnings. In order to deal with excess inventory, the company has been cutting prices and slowed down hiring.

As a result, it sees about an 11% to 13% decline in Q2 earnings, while previously it had expected a 1% decline. This also feeds into the raging inflation debate as Walmart is a bellwether for the economy. It tends to see higher revenue during inflationary and recessionary conditions as consumers prioritize value. This is materializing as same-store sales are expected to rise about 6% even without fuel, but it's hurting earnings due to the nature of these purchases.

Another factor weighing on Walmart's earnings is that it continues to focus on keeping prices low which it considers part of its strategy to gain market share and keep pressure on its competitors who may not be so well-positioned to absorb lower margins.