we are using "Cash On Delivery" Payment method in magento 1.9.0

we support cash on delivery to only some zip/pin codes locations.

means we will accept cash only from some zip codes [means locations].

under "checkout" in "shipping address", customer will type his/her "zip code" .

using that zip code we have to validation.

means if we deliver the product to that zip code, than "COD" payment method should visible under "payment method"

otherwise "COD" should not visible.

if someone is unclear with above question , please refer following link :


this is the question.

can anyone explain in detail about above solution....


also here in following link :


there is an option to enter list of zip codes that are restricted. but we need a solution for list of zip codes that allowed.


1 Answer 1


As you already created a table to store COD available pin codes, get customer's pin-code with below code and match with your table pin -code values.


Now you need to put a condition to show COD method. Update below file...


Find code near line 43

if(($_method->getCode() == "cashondelivery") && --Your custom condition--)
  • i will check and inform you soon..... Mar 27, 2015 at 11:12

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.