- Issue created by @valic
- last update
14 days ago 757 pass, 14 fail - last update
14 days ago 757 pass, 14 fail - last update
14 days ago 757 pass, 14 fail - last update
14 days ago 794 pass - Status changed to Fixed
14 days ago 11:41am 14 June 2024
In some cases when using multiple payment method types from the same payment gateway, there is a need to hide or remove specific payment method types.
Scenario:
The shop has a payment gateway commerce_braintree with Paypal options enabled. Among those are credit_card, google_pay, apple_pay, paypal_credit and paypal_pay_later options.
The default output shows all 5 options rendered as radio buttons in the payment pane.
The problem is some of these methods have specific conditions
- Apple Pay - works only on Apple devices
- Paypal Credit and Paypal Pay Later - have specific GEO restrictions.
Possible workarounds
- create multiple payment gateways of Braintree type, select a specific payment method on each, and manipulate per conditions visibility
- JS or form alter unset of specific methods
Proposed solution
Dispatch event inside \Drupal\commerce_payment\PaymentOptionsBuilder::buildOptions to allow filtering out per payment method type, or any other criteria
Fixed
2.0
Payment