mirror of
https://github.com/woocommerce/woocommerce-paypal-payments.git
synced 2025-09-08 21:52:55 +08:00
Add locations for block, do not load non-block scripts on block pages
This commit is contained in:
parent
dc3fde5abf
commit
bfaf05a96e
7 changed files with 89 additions and 9 deletions
|
@ -516,6 +516,10 @@ class SmartButton implements SmartButtonInterface {
|
|||
return false;
|
||||
}
|
||||
|
||||
if ( in_array( $this->context(), array( 'checkout-block', 'cart-block' ), true ) ) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return $this->should_load_buttons() || $this->can_render_dcc();
|
||||
}
|
||||
|
||||
|
@ -537,6 +541,9 @@ class SmartButton implements SmartButtonInterface {
|
|||
case 'cart':
|
||||
case 'pay-now':
|
||||
return $smart_button_enabled_for_current_location || $messaging_enabled_for_current_location;
|
||||
case 'checkout-block':
|
||||
case 'cart-block':
|
||||
return $smart_button_enabled_for_current_location;
|
||||
case 'product':
|
||||
return $smart_button_enabled_for_current_location || $messaging_enabled_for_current_location || $smart_button_enabled_for_mini_cart;
|
||||
default:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue