1 <?php
2 3 4 5 6 7
8 class PaymentMethodAutoHide extends Extension {
9 function () {}
10
11 12 13 14 15 16
17 function removeUnavailableMethods(& $paymentMethods, & $shippingMethodID) {
18 $shippingMethod = DataObject::get_by_id('ShippingMethod', $shippingMethodID);
19 if ($paymentMethods && $shippingMethod) {
20 foreach($paymentMethods as $paymentMethod) {
21 if (!($shippingMethod->PossiblePaymentMethods()->find('ClassName', $paymentMethod))) {
22 $paymentMethods->remove($paymentMethod);
23 }
24 }
25 }
26 }
27 }
28
[Raise a SilverStripe Framework issue/bug](https://github.com/silverstripe/silverstripe-framework/issues/new)
- [Raise a SilverStripe CMS issue/bug](https://github.com/silverstripe/silverstripe-cms/issues/new)
- Please use the
Silverstripe Forums to ask development related questions.
-