A longstanding challenge in \(\hbox {CO}_2\) flux measurements above vegetation is the unclosure of the flux balance in night-time stable boundary layers. In recent years, the impact of surface temperature heterogeneity in stable boundary layers on momentum and heat-flux balances as a result of secondary motions has received increased attention. In the current work, we set up a series of idealized large-eddy simulations in stable boundary layers and look at the effect of such surface temperature heterogeneity on the \(\hbox {CO}_2\) flux balance problem, while keeping the surface Rossby number and the background-flow stability fixed. To reflect differences in crops and vegetation, heterogeneous boundary conditions for potential temperature and \(\hbox {CO}_2\) flux are prescribed by introducing a patch in the centre of the domain, having higher temperature or \(\hbox {CO}_2\) flux than the surroundings. In the classical homogeneous temperature setting, increased \(\hbox {CO}_2\) flux in the patch leads to the development of a (shallow) internal \(\hbox {CO}_2\) boundary layer (IBL) over the patch, with a classical decoupling between the ground flux and the flux above the IBL. The introduction of locally higher temperature in the patch leads to increased \(\hbox {CO}_2\) fluxes. Even in case of a homogeneous \(\hbox {CO}_2\) flux distribution, the vertical turbulent flux increases by up to 50% for a horizontal temperature difference of only 1.65 K, resulting from a patch IBL that, close to the ground, becomes unstable, thus redistributing the background \(\hbox {CO}_2\) profile by improved turbulent mixing. When both heterogeneous temperature and \(\hbox {CO}_2\) fluxes are combined, we find that both effects compete. We further find that the introduction of surface temperature heterogeneity leads to the emergence of strong secondary motions at the spanwise patch edges. However, a detailed \(\hbox {CO}_2\) budget analysis reveals that these motions are only important for flux balances that include the patch edges. Closer to the centre of the patch the dominant mechanism relates to the development of an internal temperature and \(\hbox {CO}_2\) boundary layer over the patch.