This can be done by editing the COD module:
/includes/modules/payment/cod.php
Find this code:
PHP Code:
// disable the module if the order only contains virtual products
if ($this->enabled == true) {
if ($order->content_type != 'physical') {
$this->enabled = false;
}
}
Change to this code:
PHP Code:
// turn off COD for USPS Shipping
if (substr_count($_SESSION['shipping']['id'], 'ups') == 1) {
$this->enabled = false;
}
// disable the module if the order only contains virtual products
if ($this->enabled == true) {
if ($order->content_type != 'physical') {
$this->enabled = false;
}
}