Walmart policy is to follow state law. Starbucks got a lot of press for that, but Walmart had that policy long before they did.
If there are any problems at Walmart giving you problems when you're in accordance with state law, simply make calls up the chain of command. If you dig around on the forum (or someone provides) there's a great guy in their security department, I believe he's a regional director thereof, who is helpful and willing to correct store managers if they get their policy wrong.
It's pretty surprising that they even said anything to you about it at all, tbh. I expect better than that from Walmart.