This kind of depends on what we are calling local and how you get there as well.
Of course it's more sustainable to walk to a local shop, but if you would have to get in the car anyway, because it's too far out because you are buying a lot, then it's probably more sustainable to get it delivered, because the emissions of one trip are shared between multiple deliveries.
Buying locally produced anything is better generally. Plus when it comes to food, something that came fresh from the ground a few kilometres away just somehow feels and tastes better than something shipped halfway across a continent to me.