Money may earn a commission when you click on the products and services below. Opinions are our own,
but compensation and in-depth research determine where and how they appear. Learn more about how we make money.

Hershey's chocolate bars
Scott Olson—Getty Images

Hey, all you trick-or-treaters, don't be surprised if your candy haul is a little bit lighter this year. The cost of Halloween just went up. The consumer price index for candy and gum rose 2.1% in September, the biggest increase in three years.

The price jump shouldn't come as a complete surprise. Hershey's—maker of Reese’s Cups, Kit Kats, Kisses, and the eponymous bar—announced an 8% price hike back in July. Mars soon followed suit with a 7% hike on its products, which include M&Ms and Snickers bars. Both candy manufacturers blamed the increases on the rising cost of doing business.

“Over the last year key input costs have been volatile and remain at levels that are above historical averages,” Hershey's President of North America Michele G. Buck said in a statement. “Commodity spot prices for ingredients such as cocoa, dairy, and nuts have increased meaningfully since the beginning of the year. Given these trends, we expect significant commodity cost increases in 2015."

Still, until recently the candy index stayed low. Here are 4 developments that may account for the change.

1. Ebola fears caused a temporary spike in cocoa prices. The world's No. 1 producer of cocoa, Ivory Coast, is surrounded by Ebola-stricken countries. So is the world's No. 2 producer, Ghana.

Jack Scoville, a vice president of the Price Futures Group, said some market watchers were afraid that if Ebola spread to either country and sickened the laborers who prepare the cocoa harvest, that could spell trouble for the chocolate industry.

"There was a very legitimate fear that the harvest and the merchandising could be disrupted. That spiked prices from $3,050 [per ton] to almost $3,400 in a matter of 10 days," Scoville said.

Thankfully for everyone involved, neither Ivory Coast nor Ghana has experienced any outbreaks. And the price of cocoa has dropped back down, to around $3,100.

That said, even if Ebola fears don't change the price of your Halloween candy, Valentine's Day is another matter. "It takes some time to get the cocoa beans into an exportable position, to process the beans into cocoa and process the cocoa into candy bars," Scoville explained. "If [Ebola] does become an issue—which is becoming an increasingly big 'if'—it would be more of an issue around Valentine's Day or Easter."

2. A trade spat with Mexico has driven up sugar prices. While the rising cost of cocoa is probably the main reason candy prices are up, sugar has gotten pricier too.

U.S. sugar producers have accused Mexican sugar producers of "dumping" in the United States, selling sugar at subsidized prices that unfairly undercut domestic manufacturers. As a result of the dispute, wholesale sugar prices have risen 40% since March, according to Tom Earley, economist and trade policy specialist at Agralytica.

The trade dispute has yet to be resolved.

3. There's a lag time before candy gets more expensive. While the retail price of candy remained relatively steady until recently, the cost of raw cocoa has been rising for the past several years:

Source: International Cocoa Organization

Still, it's not surprising that it took a while for you to see the price hike at your grocery store, said Annemarie Kuhns, agricultural economist at the USDA Economic Research Service.

"With the foods that require more processing, there’s a longer time between the change in the price at the commodity level and a change in the price at the retail level," Kuhns said. "They have more leeway to change their profit margins, and they’re not as quick to change their prices."

4. Newly prosperous Asian consumers want more chocolate. If you want to know why the commodity price of cocoa is rising, look to Asia. Consumers there are hungry for Hershey's. Over the past several months, manufacturers have built additional processing facilities in Indonesia to meet the rising demand in China and Southeast Asia. That demand is driving up the cost of chocolate for everyone.

"Over the past year or two, as incomes have risen, [Asian consumers have] discovered chocolate tastes good, and they want more," Scoville said.

Well, American trick-or-treaters can understand that much.