We construct new infinite families of (near) Plotkin-optimal 2-weight or 3-weight codes over \(\mathbb {Z}_4\) by using the shortening method. Furthermore, we completely determine the Lee weight distributions of our shortened codes. To achieve our goal, we use certain families of multivariable functions, and we interpret a shortening method followed by puncturing in terms of multivariable functions. According to this interpretation, we find explicit criteria for the shortened codes to have fewer Lee weights and larger minimum Lee weights after the shortening process. As our contribution, we emphasize that non-Plotkin-optimal code families are converted to Plotkin-optimal code families after the shortening process by using our main results. Furthermore, we produce new infinite families of (near) Plotkin-optimal 2-weight or 3-weight codes over \(\mathbb {Z}_4\) , which extend the database of linear codes over \(\mathbb {Z}_4\) .