mirror of
https://github.com/woocommerce/woocommerce-paypal-payments.git
synced 2025-09-06 09:08:09 +08:00
👔 Apply branded-only limitations via new filters
This commit is contained in:
parent
236188af34
commit
362d6fb2e2
1 changed files with 26 additions and 0 deletions
|
@ -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).
|
||||
*
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue