mirror of
https://github.com/woocommerce/woocommerce-paypal-payments.git
synced 2025-09-03 08:37:53 +08:00
✨ Enforce Fastlane to be the first payment method
This commit is contained in:
parent
9a132fc050
commit
0cdfe13102
1 changed files with 16 additions and 0 deletions
|
@ -28,6 +28,8 @@ use WooCommerce\PayPalCommerce\WcGateway\Settings\Settings;
|
|||
use WooCommerce\PayPalCommerce\WcGateway\Helper\CartCheckoutDetector;
|
||||
use WooCommerce\PayPalCommerce\WcGateway\Settings\SettingsListener;
|
||||
use WooCommerce\PayPalCommerce\WcSubscriptions\Helper\SubscriptionHelper;
|
||||
use WC_Payment_Gateways;
|
||||
|
||||
/**
|
||||
* Class AxoModule
|
||||
*/
|
||||
|
@ -130,6 +132,20 @@ class AxoModule implements ServiceModule, ExtendingModule, ExecutableModule {
|
|||
}
|
||||
);
|
||||
|
||||
// Enforce Fastlane to always be the first payment method in the list.
|
||||
add_action(
|
||||
'wc_payment_gateways_initialized',
|
||||
function ( WC_Payment_Gateways $gateways ) {
|
||||
foreach ( $gateways->payment_gateways as $key => $gateway ) {
|
||||
if ( $gateway->id === AxoGateway::ID ) {
|
||||
unset( $gateways->payment_gateways[ $key ] );
|
||||
array_unshift( $gateways->payment_gateways, $gateway );
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
// Force 'cart-block' and 'cart' Smart Button locations in the settings.
|
||||
add_action(
|
||||
'admin_init',
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue