How to create a shop with variable prices

Can anyone help? I've been googling for hours and nothing I try seems to work... I want to be able to set the prices for items in a Shop Event, based on the value of a variable.
For example, the value of "Potion" is set elsewhere and stored in a variable. When the player goes to a shop, I want the sell price of "Potion" to equal the previously set variable. Any ideas?
Your best bet may be to event your own shop for this. Yanfly's Common Event Menu/Window (?) could probably be utilized to good effect for something like this. I am not aware of any plug-in that does what you're looking for although I've never looked. I assume you have, though.
Thanks for your reply Frogboy 🙂 Yes the problem I am finding is, with hundreds of items in the game, the event is MASSIVE and has so many branches etc...
I'll keep looking but if anyone else has any ideas that would be helpful. A short term fix would be if anyone knows how to "check number of item x in possession, where item x is an ID stored in a variable". That way at least I could use the "select item" command to make my own shop
https://forums.rpgmakerweb.com/index.php?threads/shop-price-by-variable.30591/

Original thread: https://forums.rpgmakerweb.com/threads/how-to-create-a-shop-with-variable-prices.87181/