Search code examples
phpmagentomodulemagento-1.7payment

How to restrict default COD in magento to certain zip codes only?


I am using Cash On Delivery Payment method in magento 1.7.0.2.

I need this payment option only for certain zip codes/pin codes.

can anyone help?


Solution

  • in COD you have a function

    public function isAvailable($quote = null)
    

    in this before last line return $checkResult->isAvailable;

    you place an if condition if($checkResult->isAvailable) call

    $this->isZipCodeallowedForCod($zipCode,$quote)
    

    and in this function apply logic to get billing address zip code from quote object and checking with list of zipcodes allowed and setting flag.

    Note : When modifying this do not modify core code use rewrite or override concept of Magento.