Etsy (ETSY -0.70%) shares have missed out on the rally so far this year. The stock has dropped more than 20%. The e-commerce company's earnings have suffered as economic headwinds weigh on the consumer's wallet -- and on general costs. Etsy offers makers of handmade goods a platform to sell their wares. Since these generally are discretionary items, it's clear demand suffers in a tough economic environment.

And, just last week, Etsy announced in a regulatory filing that it's selling a company it bought only two years ago. Etsy decided to let go of Elo7, a Brazilian company that's in the same business. This represents both good and bad news. So, considering this move, is Etsy stock a buy or a sell?

Potential in Brazil

Etsy initially bought Elo7 for $217 million. At the time, Etsy said it saw "significant potential" in Brazil's e-commerce market. And Elo7 was among the top 10 e-commerce sites in the country.

But in the recent filing with the Securities and Exchange Commission, Etsy chief executive Josh Silverman said, "Although the Elo7 team has worked very hard to build a beloved marketplace and vibrant community in Brazil, we have not seen the performance we had anticipated when we made this acquisition two years ago, in part due to the macroeconomic environment."

The transaction, a sale to Brazilian company Enjoei SA, should be completed in the third quarter of this year. Etsy didn't release the price of the sale -- so it's likely the company lost money on the deal.

Now, let's consider the bad and good news, starting with the bad. Etsy's original plan to grow in this promising market hasn't worked out. To make matters worse, the whole experience probably will weigh on earnings.

But here's the good news: Etsy recognized the problem pretty quickly and didn't stick around to watch things get worse. Instead, it made a decision that may be costly in the near term -- but getting out now will save Etsy money over the long term.

It's difficult to criticize Etsy for the original purchase. E-commerce has been growing in Latin America -- so it appeared to be a great place to expand. And the idea of buying a leader in the area rather than starting a rival operation from scratch made sense. If the general economic backdrop had been favorable, the purchase may have met Etsy's goals. That didn't happen, and Etsy quickly made a tough but necessary choice.

Management's difficult but wise decision

That boosts my confidence in the company's management. It shows management's ability to make a difficult choice even if it hurts temporarily -- because the company is focused on long-term growth. The move leaves Etsy with its core Etsy Marketplace business, the Depop vintage clothing business, and the Reverb platform for buying and selling musical instruments.

The idea of streamlining its business and focusing on the best opportunities for growth is essential in a tough market -- but it's a smart move to support growth even in an easier environment. So, this decision should help Etsy manage now and boost growth later.

And there's another reason to be optimistic. Yes, Etsy's sales have declined in recent times. But the company still has kept the massive gains it made during the earlier days of the pandemic. In the most recent quarter, Etsy Marketplace gross merchandise sales increased 164% compared to the same period four years ago. And the number of active buyers increased 119%.

I also like the fact that Etsy is a capital-light business. That means it doesn't have to make massive capital investments to grow. As a result, most of its adjusted earnings before interest, taxes, depreciation, and amortization (EBITDA) translates into free cash flow.

Meanwhile Etsy shares are trading for 21 times forward earnings estimates. And this looks very reasonable considering this company's progress and long-term potential. So, yes, Etsy's stumbled in recent times. In hindsight, Etsy made the wrong move when it bought Elo7. But, it made the right move when it decided to cut its losses and move on.

And all of this means that now is a great time to buy shares of this promising e-commerce company.