diff --git a/modules/ppcp-wc-gateway/services.php b/modules/ppcp-wc-gateway/services.php index 82c086db9..fa9b4f69b 100644 --- a/modules/ppcp-wc-gateway/services.php +++ b/modules/ppcp-wc-gateway/services.php @@ -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, diff --git a/modules/ppcp-wc-gateway/src/WCGatewayModule.php b/modules/ppcp-wc-gateway/src/WCGatewayModule.php index f01084da9..53b3b9b09 100644 --- a/modules/ppcp-wc-gateway/src/WCGatewayModule.php +++ b/modules/ppcp-wc-gateway/src/WCGatewayModule.php @@ -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 ); + } + } + ); } /** diff --git a/woocommerce-paypal-payments.php b/woocommerce-paypal-payments.php index fcf66ae12..91d085147 100644 --- a/woocommerce-paypal-payments.php +++ b/woocommerce-paypal-payments.php @@ -106,7 +106,7 @@ define( 'PPCP_PAYPAL_BN_CODE', 'Woo_PPCP' ); /** * The hook fired when the plugin is installed or updated. */ - do_action( 'woocommerce_paypal_payments_gateway_migrate' ); + do_action( 'woocommerce_paypal_payments_gateway_migrate', $installed_plugin_version ); if ( $installed_plugin_version ) { /**