From ESOUI Wiki
This function destroys the item stack that exists in a particular bag slot.
- A number representing the bag to check; it must be one of the built-in Bag values.
- The numeric index of the slot in that bag which should be checked. For most bags, this is a number ranging from 1 to the size of the bag.
-- GIVEN: -- number bagIndex -- number slotIndex -- DestroyItem(bagIndex, slotIndex)
Destroying only part of a stack
There is no built-in API function to destroy only part of a stack. If you need to destroy just part of a stack, then you will have to go through a rather involved process. You need to split the stack and then destroy it, but splitting a stack isn't instantaneous. You can request the splitting of a stack by calling the protected function RequestMoveItem, but you will need to use an EVENT_INVENTORY_SINGLE_SLOT_UPDATE event listener to know when the split actually occurs, and then destroy the stack at that time. There are additional concerns which are covered on the page for RequestMoveItem.