mirror of
https://github.com/woocommerce/woocommerce-paypal-payments.git
synced 2025-09-06 18:16:38 +08:00
Fix in the Single Product load SingleProductBootstap when we have Messages even if buttons are not present
This commit is contained in:
parent
02de8ada7f
commit
89288603c3
2 changed files with 17 additions and 1 deletions
|
@ -148,7 +148,13 @@ const bootstrap = () => {
|
||||||
miniCartBootstrap.init();
|
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(
|
const singleProductBootstrap = new SingleProductBootstap(
|
||||||
PayPalCommerceGateway,
|
PayPalCommerceGateway,
|
||||||
renderer,
|
renderer,
|
||||||
|
@ -194,6 +200,12 @@ const bootstrap = () => {
|
||||||
}
|
}
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const hasMessages = () => {
|
||||||
|
return PayPalCommerceGateway.messages.is_hidden === false
|
||||||
|
&& document.querySelector(PayPalCommerceGateway.messages.wrapper);
|
||||||
|
}
|
||||||
|
|
||||||
document.addEventListener(
|
document.addEventListener(
|
||||||
'DOMContentLoaded',
|
'DOMContentLoaded',
|
||||||
() => {
|
() => {
|
||||||
|
|
|
@ -187,6 +187,10 @@ class SingleProductBootstap {
|
||||||
|
|
||||||
this.messages.renderWithAmount(data.total);
|
this.messages.renderWithAmount(data.total);
|
||||||
|
|
||||||
|
if ( this.gateway.single_product_buttons_enabled !== '1' ) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
let enableFunding = this.gateway.url_params['enable-funding'];
|
let enableFunding = this.gateway.url_params['enable-funding'];
|
||||||
let disableFunding = this.gateway.url_params['disable-funding'];
|
let disableFunding = this.gateway.url_params['disable-funding'];
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue