♻️ Improve code documenation

This commit is contained in:
Philipp Stracker 2025-02-20 12:34:51 +01:00
parent ff943b5041
commit d4a11a1346
No known key found for this signature in database

View file

@ -77,16 +77,16 @@ class LocalAlternativePaymentMethodsModule implements ServiceModule, ExtendingMo
add_filter( add_filter(
'woocommerce_available_payment_gateways', '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 * @psalm-suppress MissingClosureParamType
*/ */
function ( $methods ) use ( $c ) { function ( $methods ) use ( $c ) {
if ( ! is_array( $methods ) || is_admin() ) { if ( ! is_array( $methods ) || is_admin() || empty( WC()->customer ) ) {
return $methods; // Don't restrict the gateway list on wp-admin or when no customer is known.
}
if ( ! isset( WC()->customer ) ) {
return $methods; return $methods;
} }