"For now, I compare the name of the items, which deletes all the items of the same name, but my first though was that I could compare their actual position in the array instead. So once I click on a slot, I use the position I clicked on to compare it with an array."
While I agree that the system is too complex and it would help you to redo it, you could append the item name with the array position number when it is added, then use that to handle the deletion like you said.