E-commerce received a shot in the arm during the pandemic, and it rapidly captured market share from traditional retailers. Now that the one-time boost is over, the e-commerce adoption trendline has reverted to its normal curve.

This regression has harmed companies like Amazon (AMZN 1.30%) and Shopify (SHOP 4.90%), at least in the near term. Both companies aggressively spent to build out their platforms, warehouse logistics, and advertising, but weren't rewarded with increased market share. Now, each company is operating at a significant loss.

Can either of these companies turn it around in 2023?

Rising expenses are affecting both companies

While Shopify and Amazon compete against each other in the e-commerce market, they are two very different companies. Shopify provides the tools aspiring commerce companies of any size can utilize to set up an online store, get their items in a fulfillment network, and process payments.

On the other hand, Amazon is much larger, and it sells its own and third-party products and delivers the packages utilizing its in-house shipping service. Additionally, it has more investments outside the core e-commerce offering, including advertisements, cloud computing, and a video streaming service.

Both stocks have had an abysmal year, with Amazon and Shopify falling 50% and 76% this year, respectively. Despite the stock movement, both companies grew sales during the third quarter.

Amazon's commerce division's sales rose 12% year over year (it grew 15% companywide), whereas Shopify's revenue rose by 22%. But the problem wasn't with the top-line growth; it was with their expenses.

Company Operating Expense Growth Operating Margin Q3 2021 Operating Margin Q3 2022
Amazon 17.6% 4.4% 2%
Shopify 64.3% (0.4%) (25.3%)

Data sources: Amazon and Shopify.

With both companies' expenses significantly outgrowing their sales, it's a massive concern. However, both companies took action to correct it with a round of layoffs. Only time will tell if these layoffs save enough to enact fundamental changes in both companies, so it's something to keep an eye on.

So do you really want to take a position in two companies whose expenses are trending in the wrong direction? The future and stock valuations say yes.

Both stocks are priced for their struggles

As mentioned before, the e-commerce industry struggled in 2022, but it's still projected to continue capturing market share from traditional retailers for some time. So if you can deal with the short-term pain these two may experience, the long-term investment opportunity is still there.

Additionally, both companies are trading at historically low valuations.

SHOP PS Ratio Chart

SHOP PS Ratio data by YCharts

While the losses many investors have sustained won't be regained for some time, I expect these stocks to be strong looking forward. However, if they cannot control their expense growth, these two could have more pain ahead.

The price action of 2022 for both stocks was a combination of profit taking, panic-selling (after some took profits), and impatience. Long-term investors can ignore the latter two but still need to exercise profit-taking from time to time. The road to recovery for both companies will be significant, but the leadership teams for both businesses are proven and should get the ship turned around.

As for which one is a better investment, I'd choose Amazon. The only reason is that Amazon's cloud computing offering gives it a nice edge. This division helps diversify Amazon and gives it some much-needed cash generation. Shopify is still a good stock, but its focus on e-commerce exposes it to a recession if one does occur in 2023.

Both companies have a lot of work to do, but their stock prices and valuations reflect that, leaving plenty of upside for investors.