mirror of
https://github.com/woocommerce/woocommerce-paypal-payments.git
synced 2025-09-05 08:59:14 +08:00
Hide credit card gateway on checkout when using Fastlane
This commit is contained in:
parent
912e0af35a
commit
44d260ea9a
1 changed files with 26 additions and 0 deletions
|
@ -20,6 +20,7 @@ use WooCommerce\PayPalCommerce\Vendor\Dhii\Container\ServiceProvider;
|
||||||
use WooCommerce\PayPalCommerce\Vendor\Dhii\Modular\Module\ModuleInterface;
|
use WooCommerce\PayPalCommerce\Vendor\Dhii\Modular\Module\ModuleInterface;
|
||||||
use WooCommerce\PayPalCommerce\Vendor\Interop\Container\ServiceProviderInterface;
|
use WooCommerce\PayPalCommerce\Vendor\Interop\Container\ServiceProviderInterface;
|
||||||
use WooCommerce\PayPalCommerce\Vendor\Psr\Container\ContainerInterface;
|
use WooCommerce\PayPalCommerce\Vendor\Psr\Container\ContainerInterface;
|
||||||
|
use WooCommerce\PayPalCommerce\WcGateway\Gateway\CreditCardGateway;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class AxoModule
|
* Class AxoModule
|
||||||
|
@ -77,6 +78,31 @@ class AxoModule implements ModuleInterface {
|
||||||
9
|
9
|
||||||
);
|
);
|
||||||
|
|
||||||
|
// Hides credit card gateway on checkout when using Fastlane.
|
||||||
|
add_filter(
|
||||||
|
'woocommerce_available_payment_gateways',
|
||||||
|
/**
|
||||||
|
* Param types removed to avoid third-party issues.
|
||||||
|
*
|
||||||
|
* @psalm-suppress MissingClosureParamType
|
||||||
|
*/
|
||||||
|
function ( $methods ) use ( $c ): array {
|
||||||
|
if ( ! is_array( $methods ) || ! $c->get( 'axo.eligible' ) ) {
|
||||||
|
return $methods;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (
|
||||||
|
! is_admin()
|
||||||
|
&& is_user_logged_in() === false
|
||||||
|
&& isset( $methods[ CreditCardGateway::ID ] )
|
||||||
|
) {
|
||||||
|
unset( $methods[ CreditCardGateway::ID ] );
|
||||||
|
}
|
||||||
|
|
||||||
|
return $methods;
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
add_action(
|
add_action(
|
||||||
'init',
|
'init',
|
||||||
static function () use ( $c, $module ) {
|
static function () use ( $c, $module ) {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue