cancel
Showing results for 
Search instead for 
Did you mean: 

Magento 2.3 - How to allow selected payment method for selected customer group by Event Observer?

Magento 2.3 - How to allow selected payment method for selected customer group by Event Observer?

I want selected customer group members only pay via Paypal, how to restrict by using Event Observer.

 

I just try this https://community.magento.com/t5/Magento-2-x-Programming/Magento-2-2-Observer-to-restrict-a-payment-... but not getting clarity, any help thanks.

1 REPLY 1

Re: Magento 2.3 - How to allow selected payment method for selected customer group by Event Observer

Hello @Aveeva 

 

Please follow the below steps to solve the issue:

  1. Create events.xml at app/code/Vendor/Extension/etc/
    <?xml version="1.0"?>
    <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Event/etc/events.xsd">
        <event name="payment_method_is_active">
            <observer name="disable_payment" instance="Vendor\Extension\Observer\PaymentMethodAvailable" />
        </event>
    </config>
  2. Create PaymentMethodAvailable.php at  app/code/Vendor/Extension/Observer/ 

I hope it helps.

Thank you.

 

Problem solved? Click Kudos and "Accept as Solution".
200+ Magento 2 Extensions for Enhanced Shopping Experience.