PHPFixing
  • Privacy Policy
  • TOS
  • Ask Question
  • Contact Us
  • Home
  • PHP
  • Programming
  • SQL Injection
  • Web3.0

Thursday, November 10, 2022

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

 November 10, 2022     magento, magento-1.7, module, payment, php     No comments   

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)
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg
Newer Post Older Post Home

0 Comments:

Post a Comment

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

Total Pageviews

Featured Post

Why Learn PHP Programming

Why Learn PHP Programming A widely-used open source scripting language PHP is one of the most popular programming languages in the world. It...

Subscribe To

Posts
Atom
Posts
Comments
Atom
Comments

Copyright © PHPFixing