Update paylater amount in block cart/checkout

This commit is contained in:
Alex P 2023-12-13 21:42:23 +02:00
parent ccc0e263dd
commit c8632e3826
No known key found for this signature in database
GPG key ID: 54487A734A204D71
4 changed files with 76 additions and 3 deletions

View file

@ -8,6 +8,7 @@ import {
normalizeStyleForFundingSource
} from '../../../ppcp-button/resources/js/modules/Helper/Style'
import buttonModuleWatcher from "../../../ppcp-button/resources/js/modules/ButtonModuleWatcher";
import BlockCheckoutMessagesBootstrap from "./Bootstrap/BlockCheckoutMessagesBootstrap";
const config = wc.wcSettings.getSetting('ppcp-gateway_data');
@ -38,6 +39,7 @@ const PayPalComponent = ({
if (!paypalScriptLoaded) {
if (!paypalScriptPromise) {
// for editor, since canMakePayment was not called
paypalScriptPromise = loadPaypalScriptPromise(config.scriptData)
}
paypalScriptPromise.then(() => setPaypalScriptLoaded(true));
@ -386,7 +388,11 @@ if (config.scriptData.continuation) {
ariaLabel: config.title,
canMakePayment: async () => {
if (!paypalScriptPromise) {
paypalScriptPromise = loadPaypalScriptPromise(config.scriptData)
paypalScriptPromise = loadPaypalScriptPromise(config.scriptData);
paypalScriptPromise.then(() => {
const messagesBootstrap = new BlockCheckoutMessagesBootstrap(config.scriptData);
messagesBootstrap.init();
});
}
await paypalScriptPromise;