All you need is to edit the file /app/code/core/Mage/Payment/Model/Method/Cashondelivery.php
Open it and add the code below to the very end of the class (just before the last “}” in the file):
public function isAvailable($quote = null)
{
if ($quote) {
// Here is the list of restricted Zip Codes
$restrictedZips = array(
'85001',
'87965'
);
$address = $quote->isVirtual() ? $quote->getBillingAddress() : $quote->getShippingAddress();
$customerZip = $address->getPostcode();
if (in_array($customerZip, $restrictedZips)) {
return false;
}
}
return parent::isAvailable($quote);
}
P.S.: Note, that with this solution you will need to enter zip-codes right in the code. If you would like to avoid this, and get the ability to enter zip ranges via the admin's panel, contact us for more detail.