Fix messages check in editor

This commit is contained in:
Alex P 2023-12-13 08:34:07 +02:00
parent a99fbc6eb3
commit 93997fac7e
No known key found for this signature in database
GPG key ID: 54487A734A204D71
2 changed files with 4 additions and 5 deletions

View file

@ -620,10 +620,6 @@ document.querySelector("#payment").before(document.querySelector("#ppcp-messages
return false;
}
if ( has_block( 'woocommerce-paypal-payments/paylater-messages' ) ) {
return true;
}
$location = $this->location();
$messaging_enabled_for_current_location = $this->settings_status->is_pay_later_messaging_enabled_for_location( $location );
@ -638,6 +634,9 @@ document.querySelector("#payment").before(document.querySelector("#ppcp-messages
return $messaging_enabled_for_current_location;
case 'block-editor':
return true;
case 'checkout-block':
case 'cart-block':
return has_block( 'woocommerce-paypal-payments/paylater-messages' ) || $this->is_block_editor();
default:
return false;
}

View file

@ -182,7 +182,7 @@ trait ContextTrait {
/**
* Checks if it is the block editor page.
*/
private function is_block_editor(): bool {
protected function is_block_editor(): bool {
if ( ! function_exists( 'get_current_screen' ) ) {
return true;
}