Changes in floral visitors' diversity and community composition have been reported to affect coffee production, which optimal growing conditions are cool to warm tropical climates found in the coffee belt. However, few studies have focused on understanding how insects' foraging behaviour (e.g., contact with floral reproductive organs) relates with coffee production. Thus, it is important to consider floral visitors' foraging behaviour, as this can influence the transfer of conspecific pollen required for plant fertilisation, the efficiency of floral visitors and improve the pollination service provided. Here, we assessed how foraging behaviour of honeybees and stingless bees affects coffee fruit set and fruit weight in conventional and agroecological managed crops. We quantified local floral resources and recorded diversity, abundance and behaviour of floral visitors at eight pairs of sites with agroecological and conventional management systems to assess how foraging behaviour of honeybees and stingless bees affects coffee fruit set and fruit weight in both types of managed crops. We found that the managed honeybee Apis mellifera and three wild bees Tetragonisca angustula, Scaptotrigona mexicana and Partamona bilineata are the principal floral visitors of coffee crops in Guatemala, whose total abundance but not richness was higher in agroecological areas. Regarding their behaviours, we observed that the average number of flowers visited by P. bilineata and its behaviour of touching the nectaries of coffee flowers were positively related to fruit set, while only the percentage of A. mellifera carrying pollen was positively related with fruit weight, suggesting that although A. mellifera is found in large quantities, wild bees are also efficient pollinators of coffee in the region. Our findings also suggest that in other tropical regions where coffee is grown and honeybees have been observed as a primary pollinator, wild bees may play an important role when considering their behaviour. In the same way, coffee farms in Guatemala are a representation of the diversity of agroecosystems found worldwide, and thus, the study of foraging behaviour of managed and wild bees and the conservation of wild bee species in different coffee agroecosystems should be emphasised to improve the production of coffee and other cash crops.