Check single product and mini card setting for displaying PayPal buttons

This commit is contained in:
dinamiko 2021-07-12 17:16:26 +02:00
parent 2efb300be8
commit ab6f8a3c99
2 changed files with 24 additions and 20 deletions

View file

@ -18,6 +18,7 @@ const bootstrap = () => {
const messageRenderer = new MessageRenderer(PayPalCommerceGateway.messages); const messageRenderer = new MessageRenderer(PayPalCommerceGateway.messages);
const context = PayPalCommerceGateway.context; const context = PayPalCommerceGateway.context;
if (context === 'mini-cart' || context === 'product') { if (context === 'mini-cart' || context === 'product') {
if (PayPalCommerceGateway.mini_card_buttons_enabled === '1') {
const miniCartBootstrap = new MiniCartBootstap( const miniCartBootstrap = new MiniCartBootstap(
PayPalCommerceGateway, PayPalCommerceGateway,
renderer renderer
@ -25,8 +26,9 @@ const bootstrap = () => {
miniCartBootstrap.init(); miniCartBootstrap.init();
} }
}
if (context === 'product') { if (context === 'product' && PayPalCommerceGateway.single_product_buttons_enabled === '1') {
const singleProductBootstrap = new SingleProductBootstap( const singleProductBootstrap = new SingleProductBootstap(
PayPalCommerceGateway, PayPalCommerceGateway,
renderer, renderer,

View file

@ -688,6 +688,8 @@ class SmartButton implements SmartButtonInterface {
), ),
), ),
'order_id' => 'pay-now' === $this->context() ? absint( $wp->query_vars['order-pay'] ) : 0, 'order_id' => 'pay-now' === $this->context() ? absint( $wp->query_vars['order-pay'] ) : 0,
'single_product_buttons_enabled' => $this->settings->has( 'button_product_enabled' ) && $this->settings->get( 'button_product_enabled' ),
'mini_card_buttons_enabled' => $this->settings->has( 'button_mini-cart_enabled' ) && $this->settings->get( 'button_mini-cart_enabled' ),
); );
if ( $this->style_for_context( 'layout', 'mini-cart' ) !== 'horizontal' ) { if ( $this->style_for_context( 'layout', 'mini-cart' ) !== 'horizontal' ) {