Add locations for block, do not load non-block scripts on block pages

This commit is contained in:
Alex P 2023-03-29 20:15:42 +03:00
parent dc3fde5abf
commit bfaf05a96e
No known key found for this signature in database
GPG key ID: 54487A734A204D71
7 changed files with 89 additions and 9 deletions

View file

@ -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: