Enable local apms setting by default on new installations

This commit is contained in:
Emili Castells Guasch 2024-08-27 10:48:38 +02:00
parent 0795abfb21
commit 42192ede97
3 changed files with 14 additions and 2 deletions

View file

@ -783,7 +783,7 @@ return array(
'desc_tip' => true,
'label' => __( 'Moves the alternative payment methods from the PayPal gateway into their own dedicated gateways.', 'woocommerce-paypal-payments' ),
'description' => __( 'By default, alternative payment methods are displayed in the Standard Payments payment gateway. This setting creates a gateway for each alternative payment method.', 'woocommerce-paypal-payments' ),
'default' => true,
'default' => false,
'screens' => array(
State::STATE_START,
State::STATE_ONBOARDED,

View file

@ -497,6 +497,18 @@ class WCGatewayModule implements ModuleInterface {
return $fields;
}
);
add_action(
'woocommerce_paypal_payments_gateway_migrate',
function( string $installed_plugin_version ) use ( $c ) {
$settings = $c->get( 'wcgateway.settings' );
assert( $settings instanceof ContainerInterface );
if ( ! $installed_plugin_version && $settings->has( 'allow_local_apm_gateways' ) ) {
$settings->set( 'allow_local_apm_gateways', true );
}
}
);
}
/**