How to delete an item by id

I have the item id. Which I need to remove from the player’s inventory.

I don’t know of the top of my head since it has been years since I did any sort of modding, but you might want to look at some of the existing clear inventory libraries or blacklists.

I don’t want to delete some item from the weight.
I need to delete a specific item, at a specific moment, from a specific player!

Yes, which is where the backlist, which needs to check ID, comes in. The clear inv plugins is just where I’d get the deletion part, not the detection.