Assuming you are using a 718, there is a function to check the amount of money in a pouch, in shops.java, you should be able to modify the current code to implement checking the money pouch, if it is enough, take the money out of there, and add the item to the inventory. else if there is not enough, but combined with that in the inventory you are able, make it remove all in the pouch, then the rest from the inventory, and another else if to just take from the inventory.