If you try to pick up an item while your inventory is full and you have a shelf in it, then said item will go into shelf's sub-inventory. You can get items back as soon as you hang the shelf.
This makes your effective inventory size 15/6=2.5 times bigger and even allows to carry things that wouldn't normally go into your inventory (i.e. full buckets)