1

I need disable cash on delivery method restricted for specific zip codes.

I use IWD One Page Checkout for my project

1 Answer 1

0

try below for checkout page , All you need is to edit the file /app/code/local/Mage/Payment/Model/Method/Cashondelivery.php

public function getInstructions()
        {
            return trim($this->getConfigData('instructions'));
        }

        public function isAvailable($quote = null)
    {
        if ($quote) {

            // Here is the list of restricted Zip Codes
            $restrictedZips = array(
    '641004'
    ,'641006'


    );

            $address = $quote->isVirtual() ? $quote->getBillingAddress() : $quote->getShippingAddress();
            $customerZip = $address->getPostcode();

            if (!in_array($customerZip, $restrictedZips)) {
                return false;
            }
        }

        return parent::isAvailable($quote);
    }
    }

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.