Hello Magento Folks?,

What’s Up! Welcome to the Magento Tutorial blog. Today will help you How to Disable Payment Method Programmatically in Magento 2. Also, go through the previously placed article How to Install Magento SUPEE 11346 [With or Without SSH]

Introduction:

The online stores are providing many methods for payments at checkout. In providing many payment method options many times the store is screwed up with managing all payment methods and the costing is not affordable by the store owners. Always there should be stability in between offering the payment methods and maintaining customer experience in your store.

To overcome these problems the store owner can disable payment methods programmatically in Magento 2. One can also restrict the payment method on the base of customer groups, shipping parameters, product/order attributes, etc. Let’s Do It?

Steps to Disable Payment Method Programmatically in Magento 2:

Step 1: add events.xml in the following path

app\code\Vendor\Extension\etc\events.xml

Then add following code

Step 2: Now add Paymentmethoddisable.php in following path

app\code\Vendor\Extension\Observer\Paymentmethoddisable.php

Then add following code

Conclusion:

Hence, after the implementation of the given above steps, you will be easily able to How to Disable Payment Method Programmatically in Magento 2. If any difficulties then comment down in the comment section below. Don’t forget to share the article with your friends.

Happy Coding! 

[Total: 5   Average: 4.8/5]