Making use of first-principles calculations, we analyze the effect of quantum ionic fluctuations and lattice anharmonicity on the crystal structure and superconductivity of P 63/mmc ScH6 in the 100-160 GPa pressure range within the stochastic self-consistent harmonic approximation. We predict a strong correction to the crystal structure, the phonon spectra, and the superconducting critical temperatures, which have been estimated in previous calculations without considering ionic fluctuations on the crystal structure and assuming the harmonic approximation for the lattice dynamics. Quantum ionic fluctuations have a large impact on the H2 molecular-like units present in the crystal by increasing the hydrogen-hydrogen distance about a 5%. According to our anharmonic phonon spectra, this structure will be dynamically stable at least above 85 GPa, which is 45 GPa lower than the pressure given by the harmonic approximation. Contrary to many superconducting hydrogen-rich compounds, where quantum ionic effects and the consequent anharmonicity tend to lower the superconducting critical temperature, our results show that it can be enhanced in P 63/mmc ScH6 by approximately 15%. We attribute the enhancement of the critical temperature to the stretching of the H2 molecular-like units and the associated increase of the electron-phonon interaction. Our results suggest that quantum ionic effects increase the superconducting critical temperature in hydrogen-rich materials with H2 units by increasing the hydrogen-hydrogen distance and, consequently, the electron-phonon interaction.