As I said though, the sell function should still be there. I'm not entirely sure how the bonus markup or markdown affects selling, but I believe you would be able to buy back any items you sell for free, which would lead to abuse. Not to mention it makes no sense to get cash for selling to a dead guy. I guess it's worth a try though.
But if you attach the script to the NPC's OnDeath, you'd only be able to access it once. Yeah, you could take everything at once, but some NPCs have an infinite supply of certain items, so it would be better to keep the store open, so to speak. So I would suggest spawning an invisible placeable that triggers the store, somewhere that would make sense like over their kiosk or on a shelf.
The store files are UTM files, found in the _s.rim of each module.