Skip to content

Wamoco/magento2-payment-method-filter

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 

Repository files navigation

Magento 2 Payment Method Filter

Module to implement custom filter logic for payment methods.

In your module di.xml declare the filter:

<type name="Wamoco\PaymentMethodFilter\Model\FilterProcessor">
    <arguments>
        <argument name="filters" xsi:type="array">
            <item name="checkmo" xsi:type="object">Vendor\Module\Model\Filter</item>
        </argument>
    </arguments>
</type>

And implement it like this:

class Filter implements \Wamoco\PaymentMethodFilter\Api\FilterInterface
{
    public function isFiltered(
        \Magento\Quote\Api\Data\PaymentMethodInterface $method,
        \Magento\Quote\Api\Data\CartInterface $quote
    ) {
        if ($method->getCode() == 'checkmo') {
          return true;
        }
        return false;
    }
}

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages