Extract module flag check

This commit is contained in:
Alex P 2023-12-20 08:56:23 +02:00
parent 31c90c149e
commit 16fbb5b4d1
No known key found for this signature in database
GPG key ID: 54487A734A204D71
2 changed files with 13 additions and 4 deletions

View file

@ -19,6 +19,17 @@ use WooCommerce\PayPalCommerce\Vendor\Psr\Container\ContainerInterface;
* Class PayLaterBlockModule
*/
class PayLaterBlockModule implements ModuleInterface {
/**
* Returns whether the block should be loaded.
*/
public static function is_enabled(): bool {
return apply_filters(
// phpcs:ignore WordPress.NamingConventions.ValidHookName.UseUnderscores
'woocommerce.feature-flags.woocommerce_paypal_payments.paylater_block_enabled',
getenv( 'PCP_PAYLATER_BLOCK' ) !== '0'
);
}
/**
* {@inheritDoc}
*/