mirror of
https://github.com/woocommerce/woocommerce-paypal-payments.git
synced 2025-09-05 08:59:14 +08:00
Disable Pay Later messaging when PayPal Vaulting is enabled
This commit is contained in:
parent
0bdc9faae9
commit
38d1b1ad9d
2 changed files with 19 additions and 0 deletions
|
@ -125,6 +125,24 @@ class SettingsListener {
|
|||
exit;
|
||||
}
|
||||
|
||||
public function listen_for_vaulting_enabled() {
|
||||
if ( ! $this->is_valid_site_request() ) {
|
||||
return;
|
||||
}
|
||||
if ( ! isset( $_POST['ppcp']['vault_enabled'] ) && ! isset( $_POST['ppcp']['save_paypal_account'] ) && ! isset( $_POST['ppcp']['dcc_vault_enabled'] ) && ! isset( $_POST['ppcp']['dcc_save_card'] ) ) {
|
||||
return;
|
||||
}
|
||||
|
||||
$this->settings->set( 'message_enabled', false );
|
||||
$this->settings->set( 'message_product_enabled', false );
|
||||
$this->settings->set( 'message_cart_enabled', false );
|
||||
$this->settings->persist();
|
||||
|
||||
$redirect_url = admin_url( 'admin.php?page=wc-settings&tab=checkout§ion=ppcp-gateway' );
|
||||
wp_safe_redirect( $redirect_url, 302 );
|
||||
exit;
|
||||
}
|
||||
|
||||
/**
|
||||
* Listens to the request.
|
||||
*
|
||||
|
|
|
@ -223,6 +223,7 @@ class WcGatewayModule implements ModuleInterface {
|
|||
* @var SettingsListener $listener
|
||||
*/
|
||||
$listener->listen_for_merchant_id();
|
||||
$listener->listen_for_vaulting_enabled();
|
||||
}
|
||||
);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue