E-commerce sales in the U.S. came in at a whopping $513.6 billion in 2018, with online retailers setting sales records during the holiday shopping season. But there is a flipside to surging sales that all companies need to prepare for: a surge in product returns.

Just as customers have come to expect fast, free shipping, they also expect free, no-hassle returns. It’s not uncommon to see return rates of up to 30% for items bought online. And clothing retailers can see return rates of 40% or higher as customers tend to select a variety of sizes or colors in their initial order, with the intention of returning what doesn’t fit or look good.

All this back and forth is great for shoppers, but it’s a big expense for retailers. How big? Return delivery costs in the U.S. topped $380 billion in 2017, and are expected to reach $550 billion by 2020. One popular fashion site booked $400 million in net sales in 2017 — but also paid out $385 million in refunds for returns.

Most companies factor return rates into the mix and keep a reserve of cash on hand to cover refunds and shipping fees, but seasonal swings or an economic downturn can deplete those reserves quickly. And then there is the labor-intensive issue of handling all those items and returning them to their proper place in the warehouse, part of the process known as “reverse logistics.”

Fortunately, technology can ease many of the pain points of the returns process. AI-driven warehouse management systems and autonomous warehouse robots that help speed goods to customers can also streamline the flow of merchandise back to the warehouse, saving time and reducing errors.

Free and easy returns are also an opportunity to build customer loyalty: shoppers who have a good experience returning merchandise usually come back again and again.