While Apple might be Berkshire Hathaway's biggest holding, Warren Buffett's favorite is arguably Coca-Cola (KO). Coke is Berkshire's longest-held investment, sitting in its portfolio for 35 years, and Buffett has sung its praises time and time again.

The Berkshire chief once famously said, "If you gave me $100 billion and said take away the soft drink leadership of Coca-Cola in the world, I'd give it back to you and say it can't be done." Buffett loves Coca-Cola products; he reportedly drinks several Cokes a day.

Despite Berkshire's support -- and Coca-Cola's evident competitive advantages, including its brand recognition, distribution network, marketing prowess, and retail and restaurant partnerships -- the stock has stumbled of late. Coca-Cola shares are down 18% year to date, while the S&P 500 is up 11%. The stock is now at its lowest point in two-and-a-half years, off 21% from its recent peak.

Does this spell opportunity or more peril ahead for Coca-Cola investors?

A new threat

The stock's decline over the last month seems to have come from a surprising source. Evidence is mounting that weight-loss drugs like Ozempic are starting to have an impact on the food and beverage industry.

The drugs, which are classified as glucagon-like peptide-1 (GLP-1) agonists, help suppress appetite by releasing a hormone that makes the digestive system feel full. A number of people who take them have reported fewer cravings for junk food.

Not surprisingly, Coca-Cola is seen as a potential victim of the boom in these drugs. On Thursday, a Walmart executive told Bloomberg that the drugs are starting to have an impact on grocery sales at the retail giant, noting that shoppers are buying less food and consuming fewer calories.

Walmart is the country's biggest grocery retailer, and investors were quick to react to the comments. Coca-Cola fell 4.8% on the news, and PepsiCo (PEP -0.62%) lost 5.2%.

Short-seller blog The Bear Cave also sounded a pessimistic note on Coca-Cola last month, citing the influence of the weight-loss drugs, new competition from influencer-driven drinks like Prime, and missed opportunities to reach a younger customer base. Additionally, reviews of Coke's new Y3000 soda, which was designed with the help of artificial intelligence (AI), have mostly been disappointing.

Is the stock headed lower?

Of the concerns above, weight-loss drugs seem to be the most serious issue facing Coca-Cola; some are hailing the new treatments as miracle drugs. Still, assuming that Coke will take a material hit from Ozempic seems like a big jump from where it is today. Coke has faced similar adversity in the past, as consumers have been turning away from sugary drinks for two decades.

In the U.S., soda sales peaked in 2004, and per capita consumption has been declining since the 1990s. Diet soda sales, moreover, plunged during much of the 2010s. However, despite the weakness in core beverage categories, stocks like Coca-Cola and PepsiCo have continued to move higher as they've diversified away from sugary beverages and grown through acquisitions:

KO Chart

KO data by YCharts.

Why this could be a buying opportunity

Investors shouldn't ignore the potential impact of the new weight-loss drugs, especially as sales in the category are expected to soar over the coming years. But Coca-Cola has proven its resilience in the past and could easily do so again.

If you buy the stock now, you'd be getting it at a discount: Its price-to-earnings (P/E) ratio is the lowest it's been in three years, and its dividend yield has risen to 3.4%. Meanwhile, the company's recent results have been strong, with organic revenue up 11% in the second quarter and currency-neutral adjusted earnings per share rising 17%.

Coke is due to report third-quarter earnings on Oct. 24. If the company can deliver solid results and tamp down concerns about Ozempic, the stock could easily recover its recent losses.