I don't know, but I think that a vague location-based merchandise system exists. However, it may just be coincidence that I only find khergit arrows in khergit towns.
Each merchant troop has it's own inventory which you can access via code. Check out fisheye's Autoloot code. It deals with troop inventory heavily, naturally. It should have all the code as examples that you'd need to remove items from an inventory. You'd just have to write the code for the conditions.
1) regroup all the items, make marks (_begin, _end) in module_constants.
2) set conditions in triggers, # Refresh Merchants etc.
a) detect which town the merchant is in, which kingdom this town belongs to.
b) setup a connection between the merchant and the town/kingdom.
c) let the merchant purchase the only items between those *_begin and *_end.
If you want to just categorize items generally, you can use the itp_type_XYZABC flags. You'll be limited, though, to bows, arrows, one-handed weapons, polearms, shields, etc. as one group. But it's quicker. It's this way in Autoloot. If you want to make distinct categories such as "One-handed Blunt", then yes, you need to do like WilliamBerne says.