CONTEXT: Cocoa (Theobroma cacao L.) is one of the world's most important agricultural commodity crops with the largest share of global production concentrated in West Africa. Current on-farm yields in this region are low and are expected to decrease in response to climate change, through warming and shifts in rainfall. Interventions intended to improve yields and climate adaptation require an understanding of the main drivers of yields across farms. OBJECTIVE: In this regard, we quantified the extent to which environmental (i.e., climate and soil) conditions drive cocoa yields and how this differs for farms achieving on average low- and high mean production levels based on an unprecedented dataset of 3827 cocoa farms spanning the environmental gradients of Ghana. We further quantified the relative importance of management practices based on a subset of 134 farms for which management information was available. METHODS: We modelled on-farm annual cocoa yield as a function of environmental variables for the large dataset and cocoa yield per tree as a function of environmental and management variables for the subset farms using mixed-effects models. Differences in effects on yield between farms with low and high mean production levels were evaluated using quantile mixed-effects models. RESULTS AND CONCLUSIONS: There was considerable variability in yields across farms, ranging from ~100 to >1000 kg ha−1 (mean = 554 kg ha−1). Mixed-effects models showed that the fixed effects (i.e., environmental variables) only explained 7% of the variability in yields whilst fixed and random effects together explained 80%, suggesting that farm-to-farm variation played a large role. Explained variation in cocoa yields per tree of 134 farms in the subset increased from 10% to 25% when including management variables in addition to environmental variables. In both models, climate-related factors had a larger effect on yields than edaphic factors, with radiation of the main dry season and that of the previous year having the strongest effects on on-farm- and tree yields, respectively. The quantile regression analyses showed that productivity in high-yielding farms (90th percentile) was more strongly driven by environmental factors than in low-yielding farms (10th percentile). In conclusion, agronomic management is the dominant determinant of on-farm cocoa yields in Ghana, more so than environmental conditions. Furthermore, high-yielding cocoa farms are more sensitive to environmental conditions than low-yielding ones. SIGNIFICANCE: Our findings suggests that good agricultural practices need to be in place before investing in additional climate adaptation practices.