How to exclude non-physical products from shipping calculations? I have an show which sells physical products and virtual products like memberships. How can I set up a situation where there is no shipping charge for the virtual products? I know that I could set up free shipping if there are virtual products in the shopping cart,  but I don't want the shipment to be free if the cart has both physical and virtual products.

Would the solution be to set the weight of the virtual products to zero? Or is there another way to implement this?
Do you have separate product types? Commerce Physical has a function that determines whether a line item is shippable: commerce_physical_line_item_shippable().

This function looks at the weight of an item. If the weight of the item is 0, then it considers it to be not-shippable.

You can also implement hook_commerce_physical_line_item_shippable_alter() and define your own logic to determine if something is shippable.

It looks like Commerce USPS implements this functionality and so you should be able to depend on this. Ideally, you'd have different product types for your physical and virtual products and your virtual products would have no weight causing them to not be factored into the shipping calculations.