show cod in magento on some zip codes

show cod in magento on some zip codes

add code like below will work for you

if($quote && $quote->getBaseGrandTotal()<Mage::getStoreConfig('payment/mpcashondelivery/max_order_total') && $quote->getBaseGrandTotal()>Mage::getStoreConfig('payment/mpcashondelivery/max_order_total')) {
            return false;
        }
        $specificcountry = explode(",",Mage::getStoreConfig('payment/mpcashondelivery/specificcountry'));
        if(Mage::getStoreConfig('payment/mpcashondelivery/allowspecific')!=0 ){
            if(!in_array($quote->getBillingAddress()->getCountry(),$specificcountry)){
                return false;
            }
        }
         $cod_charges = Mage::getModel('mpcashondelivery/pricerules')->getAppliedPriceRules();
        if($cod_charges['error']){            
            return false;
        }
       $restrictedZips = array(
           '641004'
          ,'641006'
             );

         $address = $quote->isVirtual() ? $quote->getBillingAddress() : $quote->getShippingAddress();
          $customerZip = $address->getPostcode();
      if (!in_array($customerZip, $restrictedZips)) {
         return false;
       }
        }

Leave a comment