We developed a chemical code within gadget2 which allows the description of the enrichment of the Universe as a function of redshift, taking into account detailed metal production by supernovae Ia and II, and metal-dependent cooling. This is the first numerical code that includes both chemical production and metal-dependent cooling in a cosmological context. By analysing the cosmic star formation rate, we found that the effects of considering a metal-dependent cooling are important, principally, for z ≤ 3. In simulations where primordial cooling functions are used, the comoving star formation rate could be up to 20%; lower than those obtained in runs with metal-dependent cooling functions. Within galaxy-like objects, the presence of chemical elements changes the star-formation rates and, consequently, the chemical production and patterns of stars. However, owing to non-linear evolution of the structure, the effects depend on the evolutionary history path of each galaxy-like object.