Medieval times are an area of study for me, so let me tell you a little about the way the law worked during that time. This may be a different world, but I can give you a background on history and how theft was dealt with.
First, by the time you reached the age of 12 in many principalities if you did not take action against a crime committed which you knew about you were considered a lawbreaker yourself. Everyone in the community was considered law enforcement. Goods were also tracked (as in, each item featured a maker's mark, sometimes even numbered for inventory, making it hard to fence).
Crime largely took hold in places where the Lord taxed severely. The Robin Hood legend comes from that. If you didn't benefit the community in some way (robbing from the rich and giving to the poor) most communities would turn you in. Protection from the law once you got to court only worked if you were noble, and, at least a few of these Robin Hood figures were younger sons of nobility, known to the community. They took the risk, because even if they were caught, they stood a good chance of only having to pay a fine. This did not hold true for the desperate men they worked with, who tended to be commoners on the run.
Many, but not all, shopkeepers did live in or above their shops to protect from theft.
City guards are a supplement. As I said, the entire community was expected to chase, apprehend or stop anyone who was a thief. If you were a male over the age of 12 and someone yelled "stop thief!" you were expected to throw yourself in their way or otherwise stop them. If you did not, you would be brought on charges yourself.
Now, let's talk a little about how Medieval shops were actually set up. First, this idea of coming inside a shop and browsing did not yet exist. (Look at the history of Selfridges to see what a revolutionary idea it was, and that was long after the Medieval era.) Most shops had a half door, and flap shelf. Nobody went in the shop--rather, you would look in, and see the artisan at work. Here's a picture from a little later in the 15th Century.
As you can see, unlike today, stealing, while possible during business hours, was not as easy as it is today. At night, a flap was generally lowered and locked, and they often used one of those half doors, except with a shelf extending outward to lay their goods upon when showing them. Like the picture below, only with a shelf extending outwards to the street. Glass was rare, so do disregard the glass in the picture. 
Most shop owners simply worked inside, perhaps with an assistant at the window and buyers would come by and look in or ask to see specific goods.
If you have more questions I would be happy to answer them!
Shoplifting began here in ancient Phonecia. Thieves would literally lift the corner of a shop in order to snatch the sweet, sweet olives within.
$\endgroup$