Question

I'm on Magento 1.7 and use Magestore's gift-card plugin.

When someone buys something with a gift card, it's possible that the cart total can be zero.

When it does that, it still offers both payment options: "Credit Cards" and "No Payment Information Required" (I've got the "Zero Subtotal Checkout" option enabled.)

Is it possible to:

  1. Have the "No Payment" option automatically selected? And/or:

  2. Have the "Credit Card" option hidden?

I think the current system is confusing. If the total is zero, defaults should be selected so the user can just skip onward, rather than making the user click things.

Was it helpful?

Solution

Each of the various Credit Card payment methods which Magento includes out-of-the-box include a Minimum Order Total setting. If you set this to a penny (0.01) the method should no longer show up when the value of the cart has a zero subtotal and since there would only be a single payment method now available, it would eliminate the need for the customer to choose one.

Note: I've not tested this, so can't personally say whether or not it will for certain work, but I don't see why it wouldn't. Let me know if it does! :)

OTHER TIPS

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.

Licensed under: CC-BY-SA with attribution
Not affiliated with magento.stackexchange
scroll top