Investors haven't allowed Ulta Beauty (ULTA -0.40%) stock to participate in this year's market rally. Shares are barely in positive territory through early July, compared to a 15% spike in the S&P 500.

Wall Street is worried about some factors likely to impact short-term operating trends, including slowing demand and an uptick in price cuts by competitors in the makeup and skincare niches. But there's a bigger green flag that points to excellent shareholder returns ahead. Let's take a closer look at what Ulta's customer traffic metric says about the strength of its business today.

The latest results

Investors sold the stock off after Ulta Beauty announced in late May that demand trends missed their high expectations, with comparable-store sales rising 9%. Comps had jumped 16% in the prior quarter, and Wall Street was hoping to see similarly strong results in early 2023.

Yet management said the growth met their internal targets, even though demand trends appear to be softening after several extremely strong quarters. The most recent 9% uptick came on top of an 18% spike a year ago, after all. "The year is off to a positive start," CEO Dave Kimbell explained in a press release.

News was less positive around profit margins. Ulta Beauty said it noticed more extreme price-cutting by rivals in recent weeks, and the company followed suit by reducing some of its prices to remain competitive.

This shift resulted in lower operating profit margin, which fell to 17% of sales from 19% of sales a year ago. Executives also lowered their 2023 outlook on this core profitability metric, suggesting the tough selling environment might continue at least for a few more quarters.

The green flag

Investors aren't paying enough attention to Ulta's fantastic customer loyalty, though. Traffic was up a blistering 11% in Q1, more than offsetting a 2% decline in average spending. The company's digital sales channels are performing just as well, with solid growth in its online loyalty program through late March.

These wins imply that the current profit margin slump will be temporary, and that Ulta Beauty can lead the industry out of the current cyclical downturn. The company is still predicting solid sales growth this year, with comps rising between 4% and 5% on top of last year's 16% increase and the prior year's 38% jump.

In the meantime, investors can take advantage of the current weak sentiment to buy the stock at a discount. Shares are valued at about 2.3 times annual sales today, down from around 2.7 in late April.

Of course, it's possible that Ulta's stock will become cheaper if selling conditions continue deteriorating in the makeup and beauty care niches toward a potential recession. But this is a high-performing business that's very profitable. Excellent customer traffic trends suggest it is winning market share in a tough selling environment, too. These factors should support strong returns for shareholders willing to hold through the current bout of volatility.