5

At the moment I have Paypal and Zero Subtotal Checkout payment methods enabled.

If the basket is €0 then Zero Subtotal Checkout will display however Paypal is displayed underneath it.

Whats the best way to hide all other payment methods besides from Zero Subtotal Checkout if the basket is €0

1
  • check my answer...
    – Amit Bera
    Commented Sep 5, 2014 at 7:39

1 Answer 1

5

Do this using event observer.....create an event on payment_method_is_active and depends on grandtoatal group disable and enable payment method:

See there.Implementing payment method per currency

And you need change on observer.

  <?php
    class Bh_ZeroSubtotalpaymentmethod_Model_Observer {

        public function filterpaymentmethod(Varien_Event_Observer $observer) {
            /* call get payment method */
        $method = $observer->getEvent()->getMethodInstance();

    $quote = $observer->getEvent()->getQuote();
    /* this condition will disable rest of  payment method if grandtotal  <= 0 */
        if($method->getCode()!='free' && (Mage::app()->getStore()->roundPrice($quote->getGrandTotal())<=0))
        {   

            $result = $observer->getEvent()->getResult();   
            $result->isAvailable = false;

            return;
        }
    /* this condtion prevent zero payment to display when grandtotal greater then 0 */
        if($method->getCode()=='free'){
            $quote = $observer->getEvent()->getQuote();
            if(Mage::app()->getStore()->roundPrice($quote->getGrandTotal())>0){
            $result = $observer->getEvent()->getResult();   
            $result->isAvailable = false;
            return;
            }
        }
        return;
      }
    }

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.