mirror of
https://github.com/woocommerce/woocommerce-paypal-payments.git
synced 2025-09-05 08:59:14 +08:00
Do not enable vaulting on single page and cart if paypal vault settings are disabled
This commit is contained in:
parent
42737ee017
commit
0e0c6e0d3a
1 changed files with 18 additions and 1 deletions
|
@ -580,9 +580,13 @@ class SmartButton implements SmartButtonInterface {
|
|||
if ( ! $this->settings->has( 'client_id' ) || ! $this->settings->get( 'client_id' ) ) {
|
||||
return false;
|
||||
}
|
||||
if ( ! $this->vault_settings_enabled() ) {
|
||||
|
||||
if ( $this->context() === 'checkout' && ! $this->vault_settings_enabled() ) {
|
||||
return false;
|
||||
} elseif ( ! $this->vault_setting_enabled_for_paypal() ) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return is_user_logged_in();
|
||||
}
|
||||
|
||||
|
@ -988,6 +992,19 @@ class SmartButton implements SmartButtonInterface {
|
|||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if vault enabled setting for PayPal is enabled.
|
||||
*
|
||||
* @return bool Wheter vault setting is enabled for PayPal.
|
||||
* @throws NotFoundException When a setting hasn't been found.
|
||||
*/
|
||||
protected function vault_setting_enabled_for_paypal() {
|
||||
if ( $this->settings->has( 'vault_enabled' ) && $this->settings->get( 'vault_enabled' ) ) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if vaulting for credit card is enabled.
|
||||
*
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue