<img alt="" src="https://secure.leadforensics.com/150446.png " style="display:none;">
Go to top icon

Making Payment Method Visible Only For Admin in Magento 2

Rajesh Rathod Oct 11, 2017

Magento Magento 2.0

making-payment-method-visible-only-for-admin-in-magento-2.png

Payment methods such as cash-on-delivery and check/money order need to visible in the admin-panel check-out section and not in the front-end for the customer. Magento 2 provides dynamic functionality to implement this using plugins.

Using one such plugin, we can restrict the payment method to display not on front-end and Admin section. Let us see how!

First you need to create di.xml in your module and add below dependency injections for “Cash On Delivery” and “Check/Moneyorder” payment method.

1.png

Then, here is what you need to do for:

  • Cash-On Delivery

Create Directory Structure for plugins
{Namespace}\Module\Plugin\Payment\Method\CashOnDelivery\;
Create Available.php with below code

2-1-1

  • Check/Moneyorder
Create Directory Structure for plugins
{Namespace}\Module\Plugin\Payment\Method\Checkmo;
Create Available.php with below code

e-Zest is a leading digital innovation partner for enterprises and technology companies that utilizes emerging technologies for creating engaging customers experiences. Being a customer-focused and technology-driven company, it always helps clients in crafting holistic business value for their software development efforts. It offers software development and consulting services for cloud computing, enterprise mobility, big data and analytics, user experience and digital commerce.