3

Our site currently offers 2 types of shipping method; 1. Credit Card 2. Interac (Debit)

We are looking to accept credit card payment ONLY under the certain conditions: a. Billing & Shipping postal code match b. Billing & Shipping does not match but sub-total is under $200.

Otherwise, only interac (debit) will be accepted and customers will be provided with a custom message/notification on the same page that explains 'why'.

So in another words, Interac will be the ONLY option if the customer wants to: a. Ship to a different address other than billing address AND sub-total is OVER $200.

I am wondering how I can get this going? Any modules that do this so I can implement easily? Otherwise, it would be great if someone here can provide some tips on how I can achieve this. Thanks a million in advance.

3
  • You've posted some requirements, but you haven't asked a question.
    – pspahn
    Commented Jul 24, 2014 at 22:31
  • Oh I apologize. I must've messed up the copy-and-paste when I asked the question. I am wondering how I can get this going? Any modules that do this so I can implement easily? Otherwise, it would be great if someone here can provide some tips on how I can achieve this. Thanks a million in advance.
    – user6212
    Commented Jul 25, 2014 at 16:43
  • Any input will be appreciated guys.
    – user6212
    Commented Aug 11, 2014 at 17:11

1 Answer 1

1

You can observe the event payment_method_is_active and see if the conditions are met.

public function paymentMethodIsActive($observer) {
    $event  = $observer->getEvent();
    $method = $event->getMethodInstance();
    $result = $event->getResult();
    $code   = $method->getCode();
    $quote = Mage::getSingleton('checkout/session')->getQuote();
    $billingZip = $quote->getBillingAddress()->getPostcode();
    $shippingZip = $quote->getShippingAddress()->getPostcode();
    $ubtotal = $quote->getSubtotal();
    if ($code == "credit card payment code here") {
        if ($billingZip == $shippingZip || $subtotal < 200) {
             $result->isAvailable = true;
        }
        else {
             $result->isAvailable = false;
        }
    }

    if ($code == "debit payment code here") {
        if ($billingZip != $shippingZip && $subtotal >= 200) {
             $result->isAvailable = true;
        }
        else {
             $result->isAvailable = false;
        }
    }
}

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.