Magento 2 Disable Payment method for frontend only.

Magento 2 You can disable payment method for frontend only using programmatically.

You can show the payment method in the admin area only and disable in the frontend area.

You need to create a simple module for the disable payment method in frontend. We disable the Cash on a delivery payment method from the frontend and enable the payment method in admin only.

Magento contain Magento\Payment\Model\MethodList class and Class used getAvailableMethods() function to check available method on frontend.

3 Replies to “Magento 2 Disable Payment method for frontend only.”

  1. This code works perfect. Thank you for that. But how to have the payment disabled for only 1 store when there are 2 stores?

Leave a Reply