mirror of
https://github.com/woocommerce/woocommerce-paypal-payments.git
synced 2025-09-07 18:00:15 +08:00
Add shouldRender method for the context bootstrappers
This commit is contained in:
parent
9f1a633ad9
commit
5990d9766b
4 changed files with 34 additions and 27 deletions
|
@ -6,13 +6,11 @@ class MiniCartBootstap {
|
|||
}
|
||||
|
||||
init() {
|
||||
const miniCartWrapper = PayPalCommerceGateway.button.mini_cart_wrapper;
|
||||
|
||||
if (!document.querySelector(miniCartWrapper)) {
|
||||
if (!this.shouldRender()) {
|
||||
return;
|
||||
}
|
||||
|
||||
const renderer = new Renderer(miniCartWrapper);
|
||||
const renderer = new Renderer(PayPalCommerceGateway.button.mini_cart_wrapper);
|
||||
|
||||
jQuery(document.body).
|
||||
on('wc_fragments_loaded wc_fragments_refreshed', () => {
|
||||
|
@ -21,6 +19,10 @@ class MiniCartBootstap {
|
|||
|
||||
renderer.render(this.configurator.configuration());
|
||||
}
|
||||
|
||||
shouldRender() {
|
||||
return document.querySelector(PayPalCommerceGateway.button.mini_cart_wrapper)
|
||||
}
|
||||
}
|
||||
|
||||
export default MiniCartBootstap;
|
Loading…
Add table
Add a link
Reference in a new issue