Merge pull request #2282 from woocommerce/PCP-2068-pay-pal-declares-subscription-support-when-merchant-not-enabled-for-reference-transactions

PayPal declares subscription support when merchant not enabled for Reference Transactions (2068)
This commit is contained in:
Emili Castells 2024-06-03 09:46:41 +02:00 committed by GitHub
commit a1043d4cce
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -394,7 +394,18 @@ class SettingsListener {
if ( $reference_transaction_enabled !== true ) {
$this->settings->set( 'vault_enabled', false );
$this->settings->set( 'subscriptions_mode', 'subscriptions_api' );
/**
* If Vaulting-API was previously enabled, then fall-back to the
* PayPal subscription mode, to ensure subscriptions are still
* possible on this shop.
*
* This can happen when switching to a different PayPal merchant account
*/
if ( 'vaulting_api' === $subscription_mode ) {
$this->settings->set( 'subscriptions_mode', 'subscriptions_api' );
}
$this->settings->persist();
}