Bugfix InventoryHandler to remove units of items that have been removed from the cart.

Currently the inventory handler only adjusts the units of items that are still in the cart,
but when an item is removed from the cart, the inventory unit remains. This PR fixes this.
Take into account multiple items with same variant.
Reverting a change that broke the tests.
Refactoring code to make it easier to follow.
Merge pull request #842 from Richtermeister/bugfix-inventory-handler

Bugfix InventoryHandler to remove units of items that were removed from cart