Download the PHP package smaex/customer-group-payments without Composer
On this page you can find all versions of the php package smaex/customer-group-payments. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download smaex/customer-group-payments
More information about smaex/customer-group-payments
Files in smaex/customer-group-payments
Package customer-group-payments
Short Description Restricts payment methods to specific customer groups in Magento 2.
License MIT
Informations about the package customer-group-payments
Magento 2: Customer Group Payments
Restricts payment methods to specific customer groups in Magento 2.
Intro
Adding additional checks to payment methods – to decide if a certain payment method is applicable to a certain customer or not – is pretty easy and straight forward in Magento 2.
Magento provides a rather simplistic interface for custom payment method checks, and uses a composite check to process these individual checks. Adding a custom check is therefore just a matter of injecting it into Magento’s composite check via dependency injection.
This extension implements such a custom check to decide if a certain payment method is applicable to a customer based on the customer group, along with a corresponding system configuration field for payment methods.
Prerequisite
Unfortunately, there’s currently a limitation in Magento’s code regarding this mechanism that requires us to use a small workaround, so this extension depends on another extension providing this workaround. See smaex/additional-payment-checks for more information.
How to install
Simply require the extension via Composer.
Finally, enable the module via Magento’s CLI.
How to use
While the extension provides you with all the tools you need to restrict payment methods to specific customer groups, it doesn’t do anything without some custom configuration on your part. That’s because adding system configuration fields is done via XML configuration in Magento.
To properly configure your payment methods, the best way going forward is probably to set up your own custom module (e.g., Acme_Payment
) under app/code
.
Declaring a dependency on Magento_Payment
and Smaex_CustomerGroupPayments
in your module.xml
is kinda mandatory, dependencies on other modules like Magento_OfflinePayments
depend on the payment methods actually used in your project.
The next and already final step is then to provide your own system.xml
under etc/adminhtml
in your custom module and extend the existing configuration for each payment method used in your project.
Alternative
If you’re a lazy sloth this looks like too much work (i.e., XML configuration), there’s also another extension tackling the same problem from a very different angle.
We’re hiring!
Wanna work for one of Germany’s leading Magento partners? With agile methods, small teams and big clients? We’re currently looking for experienced masochists PHP & Magento developers in Munich. Sounds interesting? Just drop me a line via [email protected]
All versions of customer-group-payments with dependencies
magento/framework Version ^102.0
magento/module-customer Version ^102.0
magento/module-payment Version ^100.2
magento/module-quote Version ^101.0
smaex/additional-payment-checks Version ^1.0