Hello Magento Friends,

Today we will get the solution on How to Show Payment Methods for Particular Categories in Magento 2.

You may have separate payment methods based on product categories. Check out How to Disable Payment Method Programmatically in Magento 2. So if you want to show payment methods for products of a particular category only, you can accomplish it using the below steps.

Steps to Show Payment Methods for Particular Categories in Magento 2:

Step 1: First, create an events.xml file inside the etc folder at the below file path

app\code\Vendor\Extension\etc

Now add the code as mentioned below.

Step 2: In the second step, create the ActivePaymentMethod.php file inside the model folder at the following path

app\code\Vendor\Extension\Observer

Then add the code as follows.

Conclusion:

This way, you can Show Payment Methods for Particular Categories in Magento 2. If you have any doubts, share them with me through the comment box. Stay updated for more Magento 2 tutorials.

Happy Coding!

Click to rate this post!
[Total: 3 Average: 5]