I'm on Magento 1.9.2 and use Magestore's gift-card plugin.
When someone buys something with a gift card and the remain order price is zero I wanted all other payment methods gone.
I found the following thread, zero subtotal cart - can I automatically select 'no payment information required'?, and one of the answers from user ReinhardL, worked really well, here is his code;
Set the sort order for Zero Subtotal Checkout as low as possible (All other active payment methods should have higher values)
Now edit (copy to local)
Mage_Checkout_Block_Onepage_Payment_Methods
and change the_canUseMethod($method)
function like this:protected function _canUseMethod($method) { if (!$method || !$method->canUseCheckout()) { return false; } if ($method->getCode() == 'free' && parent::_canUseMethod($method)) { Mage::register('payment_free_active', true); } else if (Mage::registry('payment_free_active')) { return false; } return parent::_canUseMethod($method); }
This should work quite well, as long as you don't forget to sort your payment methods, otherwise the registry value won't be set early enough, and all payment methods with a lower sort order value will still be shown.
Now my problem is that it works however when some selects the gift card payment method and then clicks continue it redirects back to the cart.
Can anyone help as to why this would happen?