Prevent enabling Standard Card Button when ACDC is enabled

This commit is contained in:
George Burduli 2024-07-10 09:23:04 +04:00
parent 36a13f6500
commit 49faab654a
No known key found for this signature in database
GPG key ID: 572A97DFDA3D2E5C
3 changed files with 44 additions and 9 deletions

View file

@ -125,10 +125,6 @@ document.addEventListener(
}
function shouldDisableCardButton() {
if (currentTabId() === 'ppcp-card-button-gateway') {
return false;
}
return PayPalCommerceGatewaySettings.is_acdc_enabled || jQuery('#ppcp-allow_card_button_gateway').is(':checked');
}
@ -157,6 +153,11 @@ document.addEventListener(
}
if (shouldDisableCardButton()) {
const standardCardButtonInput = document.querySelector('#woocommerce_ppcp-card-button-gateway_enabled');
if (standardCardButtonInput) {
standardCardButtonInput.disabled = true;
}
disabledSources = disabledSources.concat('card');
}