Your add_item subroutine adds the item to cart_ref using the item_id as a key, which means your cart can never contain more than one entry for any one item_id. I would probably use an arrayref rather than a hashref for cart_ref, so you can just push new items into the cart allowing more than one of a given item_id.
In reply to Re: Need duplicate item entries in shopping cart
by jasonk
in thread Need duplicate item entries in shopping cart
by b310
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |