Thursday, November 10, 2022

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

Issue

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.



Answered By - Oscprofessionals
Answer Checked By - David Marino (PHPFixing Volunteer)

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.