If you've walked into a grocery store anytime over the past six months or so, you know firsthand that inflation is raging. Consumer staples stocks have had to deal with rising production costs, and they are passing their costs on to customers. But just how bad is all of this -- and what are companies doing about it?

A quick look at recent updates from Unilever (UL 0.34%), Procter & Gamble (PG 0.86%), and Clorox (CLX 0.60%) can offer some insight.

Price spikes on materials and fuel have been a shock

Clorox last month announced that it was working on a third round of price increases in less than a year. That news is just the latest example of an issue that has become the norm lately in the consumer staples space. The thing is, such repeated price hikes over a short timeframe are not at all normal historically. And what's led to this situation -- a spike in the price of raw materials -- is also not normal. 

Unilever recently provided some telling numbers for key ingredients. Unilever's crude palm oil costs, for example, averaged around $752 per metric tonne in 2020. That increased to $1,131 in 2021. And in March of 2022, it had increased to $1,777. The cost for this important product ingredient has well more than doubled in roughly two years or so. Similarly, soybean oil costs jumped from $838 per metric tonne in 2020 to $1,957 in March 2022. It doesn't stop at product ingredients, either. Crude oil and aluminum, vital materials for shipping and packaging, are up materially, as well. The average prices for all of these things are higher than they've been in a decade!

It makes sense that consumer staples companies are pushing through round after round of price hikes. But there's more to it than that.

Doing the heavy lifting

Unilever has, so far, relied heavily on price increases to counteract the production cost spikes. In the most recent quarter, the company noted that underlying sales grew a heady 7.3%, with the third consecutive quarter of notable price increases. That said, the price hikes this quarter added 8.3% to underlying sales growth with a volume decline pulling 100 basis points off the total. The key to understanding Unilever's business, however, is to recognize that around 60% of its sales are in developing markets where inflation tends to be higher and more normal. In other words, it probably has a little more wiggle room to increase prices than a company that operates more in developed markets.

Clorox's situation differs, and it's not a great one in the short term. During the early days of the pandemic, there was a huge demand for the company's cleaning products. To keep up, management brought in outside production services. As demand has cooled off, that's led to high costs at the same time as sales are falling. Clorox's cleaning business looks ugly, though the rest of its operations (about two-thirds of sales) are doing reasonably well. Like peers, Clorox is raising prices, but it is also exiting those high-cost production contracts with outside manufacturers. That's helping to bring costs down in a notable fashion on top of more general cost-cutting efforts elsewhere in the portfolio.

Procter & Gamble, meanwhile, has focused on innovation to justify its price hikes. Things like razors and makeup, two key categories for the company, lend themselves to such innovation. Basically, the company is trying to prove to customers that they should pay more for higher-quality products. This is P&G's preferred method for price increases and one that Clorox makes use of, too, as often as possible, but many of the latter company's products are pretty generic in nature (its namesake bleach, for example). 

Still, P&G's focus on innovation helps explain why, of this trio, it was able to increase prices 5% across its business and get customers to shift toward higher-cost items at the same time, adding another 200 basis points to organic sales growth. Meanwhile, volume growth added another three percentage points, pushing organic sales up a huge 10% in total! Clearly, this is the best of all worlds, but it probably won't last.

Pay attention to the price hikes

There's no question that inflation is pretty tough right now, with companies across the board working diligently to offset the hit. The actual materials price hikes companies are seeing is interesting, but for investors, the more important thing to understand is what names like Unilever, Clorox, and Procter & Gamble are doing about the increased production cost and why. 

Yes, dealing with inflation is normal in the consumer products and food spaces, but that doesn't mean every company is successful in addressing the headwind. Investors will want to make sure they know what's going on at the companies they monitor so they aren't blindsided. Conversely, if you believe inflation will be a temporary headwind (as it has in the past), you might want to consider buying a company that may have temporarily misstepped (Clorox, for example) but that still has great long-term prospects.