Aims. We investigate the impact on Fe abundance determination of including magnetic flux in series of 3D radiationmagnetohydrodynamics (MHD) simulations of solar convection, which we used to synthesize spectral intensity profiles corresponding to disc centre. Methods. A differential approach is used to quantify the changes in theoretical equivalent width of a set of 28 iron spectral lines spanning a wide range in wavelength, excitation potential, oscillator strength, Landé factor, and formation height. The lines were computed in local thermodynamic equilibrium (LTE) using the spectral synthesis code LILIA. We used input magnetoconvection snapshots covering 50 min of solar evolution and belonging to series having an average vertical magnetic flux density of B vert = 0, 50, 100, and 200 G. For the relevant calculations we used the Copenhagen Stagger code. Results. The presence of magnetic fields causes both a direct (Zeeman-broadening) effect on spectral lines with non-zero Landé factor and an indirect effect on temperature-sensitive lines via a change in the photospheric T − τ stratification. The corresponding correction in the estimated atomic abundance ranges from a few hundredths of a dex up to |Δlog (Fe) | ∼ 0.15 dex, depending on the spectral line and on the amount of average magnetic flux within the range of values we considered. The Zeeman-broadening effect gains relatively more importance in the IR. The largest modification to previous solar abundance determinations based on visible spectral lines is instead due to the indirect effect, i.e., the line-weakening caused by a warmer stratification as seen on an optical depth scale. Our results indicate that the average solar iron abundance obtained when using magnetoconvection models can be ∼0.03-0.11 dex higher than when using the simpler hydrodynamics (HD) convection approach. Conclusions. We demonstrate that accounting for magnetic flux is important in state-of-the-art solar photospheric abundance determinations based on 3D convection simulations.