Chromium triiodide, CrI3, is emerging as a promising magnetic two-dimensional semiconductor where spins are ferromagnetically aligned within a single layer. Potential applications in spintronics arise from an antiferromagnetic ordering between adjacent layers that gives rise to spin filtering and a large magnetoresistance in tunnelling devices. This key feature appears only in thin multilayers and it is not inherited from bulk crystals, where instead neighbouring layers share the same ferromagnetic spin orientation. This discrepancy between bulk and thin samples is unexpected, as magnetic ordering between layers arises from exchange interactions that are local in nature and should not depend strongly on thickness. Here we solve this controversy and show through polarization resolved Raman spectroscopy that thin multilayers do not undergo a structural phase transition typical of bulk crystals. As a consequence, a different stacking pattern is present in thin and bulk samples at the temperatures at which magnetism sets in and, according to previous first-principles simulations, this results in a different interlayer magnetic ordering. Our experimental findings provide evidence for the strong interplay between stacking order and magnetism in CrI3, opening interesting perspectives to design the magnetic state of van der Waals multilayers.