0

Is there any way to display/hide "Cash on delivery" payment method for some specific cities. Can anyone guide me how/where to start code for this to achieve this custom functionality.

Thanks

Mubashir
  • 567
  • 3
  • 8
  • 25

1 Answers1

1

Take a look @ Disable payment options-only cash on delivery for particular product-magento

Using payment_method_is_active observer you could load the current checkout session quote and check what city the order is be ship to.

$checkout = Mage::getSingleton('checkout/session')->getQuote();
$shipping = $checkout->getShippingAddress();

$cashOnDeliveryCities = array('city name 1','city name 2',..)

if(in_array($shipping->getCity(), $cashOnDeliveryCities)){
    $result->isAvailable = true;
}else{
    $result->isAvailable = false;
}
Community
  • 1
  • 1
MagePal Extensions
  • 17,646
  • 2
  • 47
  • 62
  • After bit modification in the code i have been able to achieve this functionality. Thank you for your help. – Mubashir Dec 12 '13 at 12:43