The work done on an object by a force is the distance traveled by the object multiplied by the magnitude of the force in the direction traveled. So if you move along some closed path (i.e. a path that gets you back to where you started) of length $d$, acted on by a constant magnitude force $F$ that is always parallel to your path and pointing backwards along it (like friction), then the force will have done work $-Fd$, not zero.
If instead your force was a constant in both magnitude and direction, then the force would do zero work over the journey. This is because on the way to the shop, the force would be (say) pointing forwards along your path and so doing positive work, whereas on the way back from the shop the force would be pointing backwards along your path and so doing negative work. These would cancel out.
In this particular example, the force (friction) is of the former kind --- it always points backwards along your path, trying to impede your motion. An example of a force of the latter kind is gravity --- it always point downwards (at least if we're talking about small terrestrial matters). Suppose you threw something vertically up into the air. To begin with the force of gravity would be pointing in the opposite direction to the path taken, doing negative work on the body. Then as the object turned around in the air, the force of gravity (whose direction remains the same) would start to act in the same direction to the path taken. Gravity would then do positive work, precisely equal and opposite to the work it did on the way up, such that when the object returned to its original position, it would have neither gained nor lost energy. The net work done would be zero.
To reiterate: for the case of friction, the force changes direction so as to be perpetually impeding your motion. This is why the work done by the friction builds up continually, rather than cancelling out.
This makes sense: the force of friction is dissipating energy in your legs for the entirety of the journey --- when you get back, you know you've used up some energy, since you might be a bit peckish! The friction hasn't at any point been putting energy back into your legs --- it's just been consistently sapping it --- and so it must have done some work (work being the amount of energy a force puts into an object).