Ayala said his plantation, situated between 600 and 1,000 metres (1,969-3,281 feet) above sea level in the south-central department of La Paz, had been ideal for growing coffee, but with rising temperatures, production became difficult.
In the last four years, recurring drought, a plague of coffee borer beetles, and other problems linked to climate shifts put his coffee plantation on the ropes.
The farmer tried sowing varieties resistant to a widespread fungus called roya (coffee rust), which affects the leaves and harms bean production, but that failed to protect his harvest.
In low-lying areas, many producers have abandoned their crops, or sold their land to urban developers.
But Ayala started to study the benefits of cocoa, including its low cost of production, good price on international markets, and environmental value such as protecting water basins and wildlife.
"People here are starting to cultivate cocoa in zones where before there was coffee," the farmer said. "Drought and climate change are making it impossible to work with coffee, so we produce cocoa now."
Mexico and Central America, which together produce one fifth of the world's Arabica coffee beans, have been hit hard by roya and the volatility of coffee prices in the last few years.
"The situation has led many producers to change from coffee to cocoa. It is happening step by step," said Nicaraguan farmer, Luis Moreno, referring to growers in Jinotega department, one of the country's principal coffee regions. "Where they have coffee, they get a harvest and then take out (the plant) – so now they are left only with cocoa cultivation."
More profitable
Moreno is technical coordinator for the People's Community Action Association (APAC), which has been giving cocoa plants and technical help to small producers since 2014. He says the programme has been a success so far.
The farmers find it cheaper to grow cocoa because it needs fewer workers and around 40 percent less investment in inputs than coffee, while international prices are buoyant. "It is more profitable," Moreno said.
According to VECO, a Belgium-based NGO that works with small-scale farmers in developing countries, Central America has around 25,000 cocoa producers, spread across Guatemala, Honduras, Nicaragua and El Salvador, growing cocoa on roughly 12,700 hectares (31,382 acres).
VECO estimates cocoa production will expand to around 25,500 hectares in 2019.
"Many studies prove that coffee production will move higher up because of global warming," said Karen Janssens, regional director of VECO. "For this reason, cocoa could be an alternative for producers whose estates are in lower zones."
Ancestral cocoa
When the Spanish arrived in Mesoamerica in the early 1500s, they observed that indigenous people used cocoa seeds like currency.
Cocoa is a species native to the region, and was cultivated by the Aztec, Mayan and Pipil people until the 19th Century when coffee was introduced from Africa, largely replacing cocoa.
Nestor Perez, a member of the Salvadoran National Indigenous Coordinating Council (CCNIS), said indigenous communities began re-introducing cocoa trees on their lands in 2014.
"We can see (this trend) not only from an economic or environmental point of view, but we can also link it with our cultural identity, because our people grew cocoa traditionally," he said.
Indigenous peoples use cocoa to make chocolate, or in ceremonies where they burn cocoa seeds and chocolate in a wood fire to express gratitude to ‘Mother Earth’ for the harvest.
While cocoa production may be better suited to low altitudes in a warmer world, the writing is not yet on the wall for coffee. Experts predict farmers will continue to produce coffee in mountainous areas, or adapt the way they cultivate it as the climate changes.
Some coffee producers are making an effort to revive their crop.
Francisco Flores Recinos, for example, has started planting cocoa and other fruit trees among his coffee plants to diversify production on his estate in Jayaque in central El Salvador.
Flores Recinos is growing around four hectares of cocoa interspersed with coffee as part of a project supported by the Salvadoran Agriculture Ministry, which is helping more than 300 farmers cope with climate shifts.
"I thought of mixing cocoa and coffee in some areas of my estate where there was water nearby, before roya attacked," the producer explained.
If his coffee trees do suffer from roya, the profit from his cocoa crop will help cushion any losses, he added.
Source: Reporting by Nelson Renteria; editing by Megan Rowling of the Thomson Reuters Foundation, the charitable arm of Thomson Reuters that covers humanitarian news, women's rights, trafficking, property rights and climate change. Visit: http://news.trust.org
Photo: A worker shows an opened cocoa fruit at El Carmen Estate in Jayaque, El Salvador, 20 July 2016. REUTERS/Jose Cabezas