Use the new way to check if block should be enabled

This commit is contained in:
Narek Zakarian 2024-03-05 17:08:10 +04:00
parent e0a232bb49
commit 1f5e32c0b0
No known key found for this signature in database
GPG key ID: 07AFD7E7A9C164A7
3 changed files with 4 additions and 3 deletions

View file

@ -68,7 +68,7 @@ return function ( string $root_dir ): iterable {
$modules[] = ( require "$modules_dir/ppcp-save-payment-methods/module.php" )();
}
if ( PayLaterBlockModule::is_enabled() ) {
if ( PayLaterBlockModule::is_module_loading_required() ) {
$modules[] = ( require "$modules_dir/ppcp-paylater-block/module.php" )();
}

View file

@ -631,7 +631,7 @@ 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' ) && PayLaterBlockModule::is_enabled();
$has_paylater_block = has_block( 'woocommerce-paypal-payments/paylater-messages' ) && PayLaterBlockModule::is_block_enabled( $this->settings_status );
switch ( $location ) {
case 'checkout':
@ -878,7 +878,7 @@ document.querySelector("#payment").before(document.querySelector("#ppcp-messages
'wrapper' => '#ppcp-messages',
'is_hidden' => ! $this->is_pay_later_filter_enabled_for_location( $this->context() ),
'block' => array(
'enabled' => PayLaterBlockModule::is_enabled(),
'enabled' => PayLaterBlockModule::is_block_enabled( $this->settings_status ),
),
'amount' => $amount,
'placement' => $placement,

View file

@ -156,6 +156,7 @@ class SaveConfig {
case 'cart':
case 'checkout':
case 'product':
case 'product_preview':
return $placement;
case 'category':
return 'shop';