As per as magento system collectRates()
function of a shipping module model class has been responsible
for shipping activation and deactivation at checkout.
I guss that You shipping class is YourCompany_NewModule_Model_Carrier_ShippingMethod
of your module then
On collectRates()
,you can check current quote/cart have only downloable
product then basic of logic inactive the method
public function collectRates(Mage_Shipping_Model_Rate_Request $request)
{
.........
$hasOnlyDownloadproduct = 0;
$noofdonloadPro=0;
$toltalItem=0;
if ($request->getAllItems()) {
foreach ($request->getAllItems() as $item) {
$toltalItem++;
if($item->getProductTypeId()=='downloadable'):
$noofdonloadPro++;
$hasOnlyDownloadproduct=1;
else:
$hasOnlyDownloadproduct=0;
endif;
}
}
// reomve the Shippin method
if($toltalItem>0 && $noofdonloadPro>0):
// If totaly item at cart and no of download has same then disable the shipping methoo;
if($toltalItem==$noofdonloadPro):
return false;
endif;
endif;
.....
return $result;
}