Merge pull request #1585 from woocommerce/PCP-1930-pay-pal-later-message-price-amount-doesnt-update-dynamically

PayPal Later message price amount doesn't update dynamically. (1930)
This commit is contained in:
Emili Castells 2023-08-11 11:45:06 +02:00 committed by GitHub
commit 222d981df8
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 17 additions and 1 deletions

View file

@ -148,7 +148,13 @@ const bootstrap = () => {
miniCartBootstrap.init();
}
if (context === 'product' && PayPalCommerceGateway.single_product_buttons_enabled === '1') {
if (
context === 'product'
&& (
PayPalCommerceGateway.single_product_buttons_enabled === '1'
|| hasMessages()
)
) {
const singleProductBootstrap = new SingleProductBootstap(
PayPalCommerceGateway,
renderer,
@ -194,6 +200,12 @@ const bootstrap = () => {
}
};
const hasMessages = () => {
return PayPalCommerceGateway.messages.is_hidden === false
&& document.querySelector(PayPalCommerceGateway.messages.wrapper);
}
document.addEventListener(
'DOMContentLoaded',
() => {

View file

@ -234,6 +234,10 @@ class SingleProductBootstap {
this.messages.renderWithAmount(data.total);
if ( this.gateway.single_product_buttons_enabled !== '1' ) {
return;
}
let enableFunding = this.gateway.url_params['enable-funding'];
let disableFunding = this.gateway.url_params['disable-funding'];