Hello mummll, my ds was/can be (I never know if he might go back to the same behaviour) like this.
my advice is to keep taking your dd out, try just short trips, to a nearby park, somewhere you can retreat quickly from if it is not working, keep going regularly, every day if you can. Lots of praise for walking nicely, any hand holding. I would also give my ds tiny treats i.e one choc raisin when I was trying to keep him close, (this won't always work) or had a toy that would distract bring him back to me.
Bubbles can be good for the park, something your dd will want to be close to you for, and share with you, so you are in control too, no bubbles if she runs away.
I also take ds to choose a magazine, weekly, he loves this and it is good if we are somewhere with toys, and I am trying to avoid the toy meltdown/tantrum. We usually get the magazine and go to a cafe, then he is happy and has something to entertain him in the cafe. He now enjoys going to the cafe with us and it is much less stressful.
Being consistent, telling your dd where you are going next (keep language simple) and what you are going to do there. I also only went to small shops with ds, avoided big supermarkets where he had lots of space to run, as much as possible.
I hope some of this helps, you have my sympathy, I still struggle in shops with ds, but he has got so much better in the last year, he is nearly 5.