The main problem I've always had with the idea of a 'Magic Shop' or 'Magic Bazaar' in RaW D&D is the cost of living issues.
On the one hand you have the fact that every magic item created will decrease the xp of the creator, eventually to the point that they will surely fall a level if they make another item. If I recall correctly, the RaW do not allow a character to make a magic item if the xp cost will cause a loss of level.
Thus, a character - whether PC or NPC - cannot, by the RaW continuously run a magic item shop based upon their own creations. At best they must buy from others the items they wish to sell - in which case the cost of the items must rise as they are likely switch hands multiple times. At worst the shop will have to be seasonal. Perhaps it is run from mid autumn to mid spring, and during the other half of the year the supposedly scholarly wizard and magic item crafter is an adventurer / explorer, seeking either more magic items to sell or more xp so he can make more items of his own.
The second issue is that of thievery. Most spells needed to have a chance of successfully running a magic shop are prohibitively expensive and usually of high level. An adept or wizard might run a potions shop, but the first mid level rogue that comes through and their stock - especially of the more expensive potions - is gone. There are simply too many spells at those levels that would allow a thief stealthful entrance and exit without detection.
Until a wizard is high enough in level to cast Dimensional Lock (an 8th level spell, so about 15th level for the caster) and a few other defensive spells of similar level, there is no way to run a magic item shop without having regular losses each time a mid or higher level group of adventurers comes through.
Once 3rd level wizard spells are within easy reach of a rogue, bard, or other arcane skill monkey, keeping valuables safe is less about prevention and more about delay. The owner of the shop can set alarm spells, have illusions to confuse, perhaps even have a Mage's Private Sanctum in permanent effect such that the thieves at least cannot scry ahead of time to better plan their assault. But they cannot permanently place a summoned creature in the shop - nor even cast such a summoning to last the night, as the spell does not last long enough and bindings would be too costly to use each night. The best options are combining permanent walls of force with a permanent mage's private sanctum. But even this is not possible until 13th level.
Indeed, as best I can tell, only at 13th level does a magic shop become a real possibility. Envelop the entire shop in a permanent Mage's Private Sanctum and re-enforce the walls with permanent Walls of Force (including the ceilings and floors). Each night fill the shop with a Solid Fog and create another Wall of Force at the doorway. Make certain to also cast an Alarm over the entire shop's innards (or at least enough to cover every possible entrance point) to give warning should these be breached (mental warning to the caster, and possibly also audible warning at the shop itself, acting much like a car alarm in that it draws interest of those near by - hopefully including the town guard).
Yet even then, note that a simple 3rd level spell available to just about all casters (Dispel Magic) can destroy each and every one of these on a successful check. So a rock of at least 11-12th level with maxed out Use Magic Device and a wand of Dispel magic could permanently destroy all this work in a few minutes, then wander in at his leasure, steal as he pleases, and leave.
Unless more spells enter core that can deal with these issues, RaW makes a magic shop indefensable until pre-epic levels - and arguably not even then, as rogues and spells exist that even better get around defenses and spells.