I don't think that stack is the appropriate verb to use with shopping carts, although it is difficult to come up with what would be a good verb to use. Maybe something like to put the cart in the line-up? I'm not sure.
Suppose you were to hand someone five dominoes. Tell them to stack them for you. Wouldn't everyone pile them up vertically, one on top of the other? If you were to take the five dominoes and stand each one up on its short end, and have them standing up together in a row while directly up against and touching the one in front of it (just like a row of shopping carts), wouldn't the person you are talking with think you are crazy? "That's not stacking!" they would say. "That's lining them up!"
Also, consider the phrasal verb to stack up, which is synonymous with to stack.