👔 Apply branded-only limitations via new filters

This commit is contained in:
Philipp Stracker 2025-03-25 21:40:56 +01:00
parent 236188af34
commit 362d6fb2e2
No known key found for this signature in database

View file

@ -174,6 +174,8 @@ class SettingsModule implements ServiceModule, ExecutableModule {
}
);
$this->apply_branded_only_limitations( $container );
add_action(
'admin_enqueue_scripts',
/**
@ -638,6 +640,30 @@ class SettingsModule implements ServiceModule, ExecutableModule {
return true;
}
/**
* Checks the branded-only state and applies relevant site-wide feature limitations, if needed.
*
* @param ContainerInterface $container The DI container provider.
* @return void
*/
protected function apply_branded_only_limitations( ContainerInterface $container ) : void {
$settings = $container->get( 'settings.data.general' );
assert( $settings instanceof GeneralSettings );
if ( ! $settings->own_brand_only() ) {
return;
}
/**
* In branded-only mode, we completely disable all white label features.
*/
add_filter( 'woocommerce_paypal_payments_is_eligible_for_applepay', '__return_false' );
add_filter( 'woocommerce_paypal_payments_is_eligible_for_googlepay', '__return_false' );
add_filter( 'woocommerce_paypal_payments_is_eligible_for_axo', '__return_false' );
add_filter( 'woocommerce_paypal_payments_is_eligible_for_save_payment_methods', '__return_false' );
add_filter( 'woocommerce_paypal_payments_is_eligible_for_card_fields', '__return_false' );
}
/**
* Outputs the settings page header (title and back-link).
*