2.81 Transparent Background Shadow Catcher
There is a "shadow catcher" option in the object visibility properties. It works only in cycles. Actually I don't know of a simple easy way to do it in Eevee.