No a law wasn't broken but what would've happened if I walked away? Would they have tried to detain me? If not, does that make the search optional? If so, would it be a lawful detention?
Probably, because by refusing a simple check you'd likely then give them reasonable grounds to suspect you were attempting a theft and they could thus detain you because of it i'd have thought.