We want to hide particular payment method if subtotal is zero.
We are giving 100% discount for some products, so that if customers try to buy those products, then I want to hide some custom payment method [code: hdfc]
magento-1.9payment-methods
We want to hide particular payment method if subtotal is zero.
We are giving 100% discount for some products, so that if customers try to buy those products, then I want to hide some custom payment method [code: hdfc]
Best Answer
You can add
min_order_total
setting insystem.xml
:Now you can see a Text box in admin
Minimum Order Total
, set it's value to 1. So this method will not be shown for all orders below order total of 1.OR if you want to disable payment method programatically, use below code :
Magento provides the
isAvailable()
method in the model of the each payment method. This method tell Magento if the corresponding payment method is available or not for checkout.Step 1 : Open the
config.xml
in your custom module and do following changes:Step 2 : Create the new Model file in your custom module at the location:
app/code/local/Myproject/Mymodule/Model/Method/Purchaseorder.php
. In this file create theisAvailable()
method as:Referenced from here : Dynamically Enable/Disable Payment Method