mirror of
https://github.com/woocommerce/woocommerce-paypal-payments.git
synced 2025-08-31 04:58:28 +08:00
Disable funding soures for Pay Later preview
This commit is contained in:
parent
7051e86003
commit
2775f7dd9d
4 changed files with 22 additions and 3 deletions
|
@ -64,6 +64,7 @@ import MessageRenderer from "../../../ppcp-button/resources/js/modules/Renderer/
|
|||
const disableFundingInput = jQuery('[name="ppcp[disable_funding][]"]');
|
||||
let disabledSources = disableFundingInput.length > 0 ? disableFundingInput.val() : PayPalCommerceGatewaySettings.disabled_sources;
|
||||
const isPayLaterButtonEnabled = payLaterButtonInput ? payLaterButtonInput.checked : PayPalCommerceGatewaySettings.is_pay_later_button_enabled
|
||||
const payLaterButtonPreview = jQuery('#ppcpPayLaterButtonPreview');
|
||||
const settings = {
|
||||
'client-id': PayPalCommerceGatewaySettings.client_id,
|
||||
'currency': PayPalCommerceGatewaySettings.currency,
|
||||
|
@ -77,6 +78,10 @@ import MessageRenderer from "../../../ppcp-button/resources/js/modules/Renderer/
|
|||
disabledSources = disabledSources.concat('credit')
|
||||
}
|
||||
|
||||
if(payLaterButtonPreview?.length) {
|
||||
disabledSources = Object.keys(PayPalCommerceGatewaySettings.all_funding_sources);
|
||||
}
|
||||
|
||||
if (disabledSources?.length) {
|
||||
settings['disable-funding'] = disabledSources;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue