(Bloomberg) — Hershey Co. cut its sales and earnings outlook for the year as shoppers continue to reduce purchases of higher priced chocolates and candies.

The maker of Reese’s and Dot’s Pretzels said Thursday that it now expects net sales growth to be around 2%, from the previous range of 2% to 3%, and that adjusted earnings per share will be “down slightly” from unchanged before.

Net sales in the second quarter sank 17% to $2.07 billion, trailing the $2.31 billion average estimate of analysts surveyed by Bloomberg. Adjusted earnings were $1.27 per share, also below expectations.

The company’s shares rose 0.5% in New York trading at 10:45 a.m., erasing an earlier decline. The stock had gained 5.9% year to date through Wednesday’s close, compared with a 9.5% gain for the S&P 500 Consumer Staples Index.

Record high cocoa prices have hit Hershey’s margins and forced the company to raise their prices further — even as consumers cut down on brand name purchases at the supermarket. Hershey said that that higher commodity costs eroded profitability in the period, offsetting productivity improvements and higher prices.

In the company’s statement, Chief Executive Officer Michele Buck noted that consumers are “pulling back on discretionary spending.”

Confectionery companies may be poised for some relief: Earlier this week, Oreo-maker Mondelez International Inc., projected cocoa prices will fall.

“We soon expect the market correction to a more sustainable price,” Chief Executive Officer Dirk Van de Put said during the company’s earnings call on July 30. The outlook for next season’s main crop is “encouraging” and a clearer indication on price trends could come by September, Chief Financial Officer Luca Zaramella added.