mirror of
https://github.com/woocommerce/woocommerce-paypal-payments.git
synced 2025-09-04 08:47:23 +08:00
Fix context check
This commit is contained in:
parent
16fbb5b4d1
commit
22e908ff25
2 changed files with 5 additions and 3 deletions
|
@ -624,6 +624,8 @@ document.querySelector("#payment").before(document.querySelector("#ppcp-messages
|
|||
|
||||
$messaging_enabled_for_current_location = $this->settings_status->is_pay_later_messaging_enabled_for_location( $location );
|
||||
|
||||
$has_paylater_block = has_block( 'woocommerce-paypal-payments/paylater-messages' );
|
||||
|
||||
switch ( $location ) {
|
||||
case 'checkout':
|
||||
case 'cart':
|
||||
|
@ -636,9 +638,9 @@ document.querySelector("#payment").before(document.querySelector("#ppcp-messages
|
|||
return true;
|
||||
case 'checkout-block':
|
||||
case 'cart-block':
|
||||
return has_block( 'woocommerce-paypal-payments/paylater-messages' ) || $this->is_block_editor();
|
||||
return $has_paylater_block || $this->is_block_editor();
|
||||
default:
|
||||
return false;
|
||||
return $has_paylater_block;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -184,7 +184,7 @@ trait ContextTrait {
|
|||
*/
|
||||
protected function is_block_editor(): bool {
|
||||
if ( ! function_exists( 'get_current_screen' ) ) {
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
$screen = get_current_screen();
|
||||
return $screen && $screen->is_block_editor();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue