Swedish clothing retailer H&M has dense clusters of stores in cities all over Western Europe, the US, and parts of Asia. If you walked into one of them over the last three months, there’s a good chance you saw racks of clothes on sale. The reason, as H&M acknowledged in its latest earnings report (pdf), is that it overestimated how much shopping people would do in those brick-and-mortar locations.

That miscalculation has hit the company’s bottom line hard. For the quarter ended Aug. 31, profit dropped about 20% compared to the same period last year, plunging roughly a billion Swedish kronor down to about SEK3.8 billion ($467 million).

Aggressive markdowns to clear racks of unsold clothes were the big culprit, but they were a side effect of another problem. “The fashion retail sector is growing and is in a period of extensive and rapid change as a result of ongoing digitalisation,” CEO Karl-Johan Persson said in a statement. “The competitive landscape is being redrawn, new players are coming in and customers’ behaviour and expectations are changing, with an ever greater share of sales taking place online.”

Some adjusting is in order. In the regions where H&M is established, it’s going to close around 90 stores this year, and relocate others. It’s still going to open more new stores than it shutters, but will focus on regions where there’s more room to grow. It has recently opened shops in Kazakhstan, Colombia, Iceland and Vietnam, for example, bringing its total store count globally to 4,133. For comparison, its biggest competitor, Zara, had 2,093 stores globally, as of July 31 (pdf).

H&M spent years building out its store footprint at a rapid clip, even opening giant new stores within sight of others. But the profits the company brought in per square foot at its stores had been dropping for some time. In February, it announced it would slow its store growth and focus more on e-commerce.

The company is late to the game. Pure e-commerce competitors, from fast-fashion upstarts such as ASOS and Boohoo to massive European clothing retailer Zalando, have been taking those online clothing sales for themselves.

H&M said in its recent earnings statement that e-commerce sales have been growing, but they still weren’t enough to make up for the reduced number of shoppers going to its physical stores. Its overall sales, as a result, haven’t met targets.

It certainly won’t neglect e-commerce any longer. It intends to be online in 43 markets by the end of the year, versus 69 where it has physical stores. “The plan is that in the future we will offer online shopping in all store markets as well as in other markets,” it said.

India is one important country where it’s slated to open e-commerce next year. It better hurry though. Zara, which announced a shift toward more e-commerce last year, is already there.