I handle magic item shops by telling my players at the start of the campaign caveat emptor.
Most magic items found for sale are just outright fakes. If not fakes, then most of them are cursed. If not cursed, then they are usually stolen. Even if not stolen, then there are often other strings attached. Only a small minority have nothing wrong with them and are an item that performs exactly as claimed.
Players naturally avoid them for those reasons. In the cases where they do want to buy magic items from a merchant, they are very cautious in checking the item with Perception and Appraise checks, casting Detect Magic and other magic spells to examine it thoroughly, and looking into the trustworthiness of the merchant.
I find this approach helps keep using magic shops as a crutch or a min-max tool to a minimum while other some flavor and fun elements.
What if they take crafting feats?
I make the spellcraft checks for the character. They never know for sure if they failed or succeeded (unless the DC. Failing by 5 or more means the item is actually cursed in some way, as per the RAW. Higher level characters with a high spellcraft check bonus can be pretty confident small little items they make are OK.
One person asked about the magic item merchant being brought to the authorities for selling fake or cursed items. On what charge? There are no regulations on business transactions in this campaign world. It's laissez-fair capitalism. Besides the merchant can always just claim ignorance. "Well, that's what the guy who sold it to me said it did!"
Yes, players can get +10 on spellcraft through the Identify spell. That is still not a guarantee of success and it must beat the DC by 10 to identify a cursed item.