Properly handle item quantities when adding to cart

Fixes #2294