A growing appetite for chocolate, particularly dark chocolate, which requires more cocoa, in China and other Asian markets is the primary cause, commodity analysts say.
"What's driving up the price, really, is rising demand for cocoa in Asia, though it also was pretty strong in North America and Europe," said Edward George, head of soft commodities research at EcoBank.
Another factor is the harmattan, a dry, dusty wind that began sweeping the major cocoa producing countries in West Africa in December, the beginning of the prime cocoa harvesting season. The harmattan has been worse than usual this year.
Cocoa trees also suffered attacks by witches' broom and frosty pod, fungi that can cause steep losses.
Read More Which city spends the most for Valentine's Day?
The average dollar price for a ton of cocoa was $2,921.05 last month, according to the International Cocoa Organization. That was slightly higher than the price a year earlier — but less than the peak average price of $3,270.27 in August, which reflected fears that Ebola might hinder the harvest of cocoa beans in Africa.
Several major chocolate companies declined requests for interviews on the effects of the high price of cocoa on their businesses. But Hershey, Mondelez International and Lindt & Sprüngli, a Swiss company that owns Russell Stover, all raised prices as much as 8 percent last year to offset cocoa costs. Hershey's raised prices across all its products.
"L&S, like other companies in the chocolate industry, had to make occasional price adjustments on selected products in 2014 to absorb some of the raw material cost challenges — even if at first we always try to counter these challenges with increases in efficiency and volume," Sylvia Kälin, head of Lindt & Sprüngli's corporate communications, wrote in an email. Mars, the maker of M&Ms and Milky Way, also announced plans to raise prices.
Ms. Kälin said consumers so far had not punished the company for raising prices.
Read MoreForget Valentine's Day, we buy chocolate all year
Data from Nielsen, a consumer research firm, hints at the price increases. While the amount of chocolate Americans bought last year rose 1.2 percent, to 2.2 billion pounds, the amount they paid for it rose 2.6 percent, to $13.6 billion.
Mondelez, which has several brands that use chocolate, like Cadbury, Milk and Lu, was not so lucky. It was the first to raise prices in the first half of last year, and European retailers refused to play along. That led to what Irene Rosenfeld, chief executive of Mondelez, described in an August conference call as "extended disputes and near-term distribution losses."
Mr. George, the commodity analyst, said the backlash was a surprise. "Several companies were shocked by how consumers simply switched to cheaper chocolate or stopped eating chocolate altogether," he said.