This week executives at Walmart, the nation’s largest retailer and grocer, signaled they had begun to pass on more of the company’s own fuel and food costs to the consumer after being caught off guard by the magnitude of their extra expense. Similarly, Target said it too has been raising prices to better reflect its own costs. “Some of those costs did not flow through because we believed they were short term in nature,” said John Furner, president of Walmart U.S., during a conference call Tuesday about the company’s latest quarterly earnings. But they have made progress recently in “matching pricing to the increased costs,” Walmart CEO Doug McMillon said. Walmart, known for rollbacks and “everyday low prices,” had been slow to pass higher costs on to its customers in part because the retail giant’s strategy hinges on trying to offer lower prices than its competitors. Target too is known for its discount prices. But operating income at both companies shrank significantly in the latest quarter as their own costs increased—particularly for fuel to transport merchandise—eroding profit margins. The disappointing results highlight how hard it is for companies to balance the competing interests of customers and investors when inflation is so high. Walmart executives said they would try to keep costs down for their “opening price point” products—that is, the lowest-priced items for any given product, especially in the grocery aisles. The company will focus on food staples—including bread, milk, tuna, and macaroni and cheese—aimed at “helping a family that’s at the lower end of the income scale be able to afford to feed their families during this inflationary time,” McMillon said. Still, “double-digit increases in food supplies means lower income Walmart shoppers may start to feel more pain at the register,” Edward Moya, senior market analyst at OANDA, said in an email. Target executives highlighted how much more expensive it’s been for them to ship items because of gas prices hitting all-time highs.  “While it’s always the last lever we pull, external conditions led us to raise prices across a broad set of items in multiple categories,” Target CEO Brian Cornell said during a Wednesday conference call about the company’s earnings. “You should expect us to surgically pass along costs where appropriate, but we’re also laser-focused on protecting our value position in this environment, and making sure we provide great affordability to the guests in a time of need.” Have a question, comment, or story to share? You can reach Diccon at dhyatt@thebalance.com. Want to read more content like this? Sign up for The Balance’s newsletter for daily insights, analysis, and financial tips, all delivered straight to your inbox every morning!