Update modules/ppcp-axo/src/AxoModule.php

Co-authored-by: Danny Dudzic <d.dudzic@syde.com>
This commit is contained in:
Carmen Maymó 2025-04-03 09:44:50 +02:00 committed by GitHub
parent c2a29ba731
commit c4f84bf903
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -349,35 +349,25 @@ class AxoModule implements ServiceModule, ExtendingModule, ExecutableModule {
}
);
// we need to remove Fastlane when we are in order pay page
add_filter(
'woocommerce_available_payment_gateways',
// Remove Fastlane on the Pay for Order page.
add_filter(
'woocommerce_available_payment_gateways',
/**
* Param types removed to avoid third-party issues.
*
* @psalm-suppress MissingClosureParamType
*/
static function ( $methods ) use ( $c ) : array {
if ( ! is_array( $methods ) ) {
return $methods;
}
if (! is_wc_endpoint_url( 'order-pay' )) {
return $methods;
}
foreach ( $methods as $key => $method ) {
if ( $method && $method->id === 'ppcp-axo-gateway' ) {
unset( $methods[ $key ] );
break;
}
}
return $methods;
}
);
static function ( $methods ) {
if ( ! is_array( $methods ) || ! is_wc_endpoint_url( 'order-pay' ) ) {
return $methods;
}
// Remove Fastlane if present.
unset( $methods[AxoGateway::ID] );
return $methods;
}
);
return true;
}