Groceries have become one of the most fiercely contested areas of retail. Amazon upped the ante in June with its $13.4 billion purchase of Whole Foods, giving it a major foothold in the industry. Lidl, the German supermarket chain, is also making a big push to open stores in the United States.

Grocery delivery companies like Fresh Direct have spawned a contest among traditional grocers and start-ups to offer faster home delivery.

Amid this heated competition, Walmart has been experimenting with different ways to get an edge. In a few cities, it works with Uber to deliver groceries to homes.

And last month, Walmart said it would begin testing a home-delivery service in which a worker loads the food into the refrigerator, even when no one is home. The customer can watch the process remotely from a home security camera and track when the delivery worker enters and leaves the house.

While these initiatives are limited to only a few states, the company’s grocery pickup is widespread. Walmart is betting that a big part of the country (“from Scranton to Sacramento,” one Walmart executive said) is more of a drive-through than delivery culture.

There is a risk that Walmart’s new grocery strategy could undercut its sales of other products. Selling groceries has lower profits, but it brings customers into the store regularly, allowing Walmart to push bigger-ticket items.

“That is the philosophy of the Supercenter: You put all these other categories under one roof,” said Gene German, a professor emeritus of food marketing at Cornell University. “So if the customers don’t go into the stores, that could be a negative.”