Even if you're not a clothing retailer, use tags.
Implementing tag-based sorting within your shopping cart can do the trick quite easily. This can equate to the UX for clothing stores - some retailers add "tags" to clothes to signify that it's "Mens", "Large", "Kids", etc. All of my items go to the same shopping cart, and I can (at all times) see which tags apply to which items. That way, if I accidentally added a "small" shirt, but wanted a "medium", I could have every reasonable opportunity to notice and correct this.
Adding a sorting option (the "Only" function) can further help sort the products and identify which is which, through the use of tags. Additionally, adding an icon to each thumbnail to alert a user that a product is digital (or physical - whichever is "less common") could help. Upon mouseover it would let the user know "This item is a digital-download".
The main idea here is to let customers have every opportunity to understand what a product is before paying for it.
download bmml source – Wireframes created with Balsamiq Mockups