Wal-Mart is expanding the use of lockers like these in use in convenience stores in Canada to give shoppers more options and convenience when buying from it online. Image: Walmart.ca.

Customers abandoning their online shopping carts will leave behind approximately $4 trillion in merchandise this year, according to Business Insider, so anything a business can do to complete the sale will help the bottom line.

Wal-Mart (NYSE:WMT) has long been an early adopter of strategies to close that last-mile gap between the customer and their purchase. It was one of the first to promote ship-to-store free delivery and a low order total to qualify for no-cost shipments.

But Amazon.com (NASDAQ:AMZN) continues to challenge Wal-Mart and the industry to come up with new ways of retaining customers. Its $99-a-year Prime membership program offering perks including free, two-day shipping on tens of thousands of items purchased on its site is a tough deal to beat. Startups like Jet.com seek to beat Amazon at its own game by undercutting it on price and offer free shipping, but that hardly seems like a sustainable business model.

Now, Wal-Mart is ramping up its use of shipment lockers, something else that Amazon offers. For customers who don't want to wait in the customer service line to pick up their orders or have them left on their doorsteps for fear of the package being stolen -- particularly around the holidays, incidents of such crimes always go up -- the retailer is offering customers in some markets the option of having their order delivered to a storage locker at the store.

After a purchase is made, Wal-Mart sends a special code via email to the customer who can then go to his local store to pick it up. An ATM-like screen lets the customer punch in the code to unlock the locker and retrieve his item.

By itself it's not going to be a game-changer or suddenly put Wal-Mart ahead of Amazon, but giving customers a variety of options to choose how they get their order increases the likelihood customers will complete their purchase on the site and not abandon their shopping carts.

Amazon.com has pioneered the use of lockers, though not all of its retail partners have been happy with helping their online competitor. Image: Amazon.com.

While online shopping has been growing in importance for retailers for some time, this year it seems to be overshadowing the industry. Even among struggling retailers like Macy's (NYSE:M), e-commerce has been the one bright spot in their earnings reports.

The department store chain reported net sales fell 5% in the third quarter, and though it didn't break out e-commerce sales, executives did say its digital business grew by double digits year over year and the business will be key to its future success. CEO Terry Lundgren noted Macy's is the seventh-largest Internet retailer in the U.S.

Wal-Mart also saw 10% greater web sales in the third quarter, but expects them to grow at a rate in the mid- to high teens in the future. It has invested significant sums into e-commerce, and this past quarter opened its fifth next-generation, e-commerce fulfillment center in Atlanta, with more than 1 million square feet of space.

The lockers are but one component of this, though they aren't really a new idea. Wal-Mart began testing them two years ago and has been slowly rolling them out into more markets. Amazon also has experimented with them, starting back in 2011, along the way installing lockers in retailers like Staples and RadioShack until the retailers realized they were giving the e-tailer the rope with which to hang them. Amazon still uses them at its campus bookstores, and has partnered with convenience stores like 7-Eleven to have its Click & Collect lockers installed. Amazon says it has hundreds of locker locations nationally and is adding more every day.

Wal-Mart's advantage is its vast network of brick-and-mortar stores that can serve as distribution hubs for the goods it sells online. There are 4,600 Walmarts in the U.S.  Because Amazon has to rely upon the kindness of strangers to install lockers, it can't be as integral a component in the universe of shipping options for it as it can be for Wal-Mart.

A locker ultimately is a low-cost way to stay competitive with a tough rival.