dev question: plugin which can hide payment/shipment methods

Started by sandomatyas, March 12, 2024, 09:57:40 AM

Previous topic - Next topic

sandomatyas

I have a developer question: Is it possible to write a plugin that can hide or make payment/shipment methods not selectable based on the cart content or customer data or any custom logic, after the original plugin conditions have been triggered? It would be an extension of conditional logic, but without modifying the original plugin.

Some examples:
Hide the PayPal payment method based on certain email addresses (e.g., when there is a blacklist for email addresses).
Hide specific shipment methods for particular states when certain products are in the cart and a coupon is applied.
Hide some payment methods on weekends.

I know there are several methods to limit these, but I'm attempting to write a single system or similar plugin that can limit these without modifying the original PayPal plugin, and also work with third-party checkout solutions like Rupostel OPC or VP OPC. I was considering if there is a plugin method that can be triggered after all the checkConditions have been executed, as a final filter where I can hide additional methods.