From d4a11a134696fc3f44e3b9e5701e16c0a98c84fe Mon Sep 17 00:00:00 2001 From: Philipp Stracker Date: Thu, 20 Feb 2025 12:34:51 +0100 Subject: [PATCH] =?UTF-8?q?=E2=99=BB=EF=B8=8F=20Improve=20code=20documenat?= =?UTF-8?q?ion?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/LocalAlternativePaymentMethodsModule.php | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/modules/ppcp-local-alternative-payment-methods/src/LocalAlternativePaymentMethodsModule.php b/modules/ppcp-local-alternative-payment-methods/src/LocalAlternativePaymentMethodsModule.php index e97fee8e8..2e8105ff4 100644 --- a/modules/ppcp-local-alternative-payment-methods/src/LocalAlternativePaymentMethodsModule.php +++ b/modules/ppcp-local-alternative-payment-methods/src/LocalAlternativePaymentMethodsModule.php @@ -77,16 +77,16 @@ class LocalAlternativePaymentMethodsModule implements ServiceModule, ExtendingMo add_filter( 'woocommerce_available_payment_gateways', /** - * Param types removed to avoid third-party issues. + * Filters the "available gateways" list by removing gateways that + * are not available for the current customer. + * + * This callback only _removes_ items from the payment gateway list. * * @psalm-suppress MissingClosureParamType */ function ( $methods ) use ( $c ) { - if ( ! is_array( $methods ) || is_admin() ) { - return $methods; - } - - if ( ! isset( WC()->customer ) ) { + if ( ! is_array( $methods ) || is_admin() || empty( WC()->customer ) ) { + // Don't restrict the gateway list on wp-admin or when no customer is known. return $methods; }