File tree Expand file tree Collapse file tree 2 files changed +19
-16
lines changed
modules/ppcp-settings/src Expand file tree Collapse file tree 2 files changed +19
-16
lines changed Original file line number Diff line number Diff line change 3333 ( require "$ modules_dir/ppcp-blocks/module.php " )(),
3434 ( require "$ modules_dir/ppcp-paypal-subscriptions/module.php " )(),
3535 ( require "$ modules_dir/ppcp-local-alternative-payment-methods/module.php " )(),
36+ ( require "$ modules_dir/ppcp-settings/module.php " )(),
3637 );
3738 // phpcs:disable WordPress.NamingConventions.ValidHookName.UseUnderscores
3839
9192 $ modules [] = ( require "$ modules_dir/ppcp-axo-block/module.php " )();
9293 }
9394
94- if ( apply_filters (
95- 'woocommerce.feature-flags.woocommerce_paypal_payments.settings_enabled ' ,
96- true
97- ) ) {
98- $ modules [] = ( require "$ modules_dir/ppcp-settings/module.php " )();
99- }
100-
10195 return $ modules ;
10296};
Original file line number Diff line number Diff line change @@ -66,20 +66,29 @@ class SettingsModule implements ServiceModule, ExecutableModule {
6666 * Returns whether the old settings UI should be loaded.
6767 */
6868 public static function should_use_the_old_ui () : bool {
69- // New merchants should never see the #legacy-ui.
70- $ show_new_ux = '1 ' === get_option ( 'woocommerce-ppcp-is-new-merchant ' );
69+ /**
70+ * Determine if the new Settings UI is disabled via feature flag.
71+ *
72+ * This is the highest-priority check: if the `woocommerce.feature-flags.woocommerce_paypal_payments.settings_enabled` filter
73+ * is used to disable the new UI, it will override all other conditions.
74+ */
75+ if ( ! apply_filters (
76+ // phpcs:ignore WordPress.NamingConventions.ValidHookName.UseUnderscores -- feature flags use this convention
77+ 'woocommerce.feature-flags.woocommerce_paypal_payments.settings_enabled ' ,
78+ getenv ( 'PCP_SETTINGS_ENABLED ' ) !== '1 '
79+ ) ) {
80+ return true ;
81+ }
7182
72- if ( $ show_new_ux ) {
83+ // New merchants always see the new UI if the filter above is not used.
84+ if ( '1 ' === get_option ( 'woocommerce-ppcp-is-new-merchant ' ) ) {
7385 return false ;
7486 }
7587
76- // Existing merchants can opt-in to see the new UI .
77- $ opt_out_choice = 'yes ' === get_option ( SwitchSettingsUiEndpoint::OPTION_NAME_SHOULD_USE_OLD_UI );
88+ // Existing merchants can opt out via DB option .
89+ $ opt_out = 'yes ' === get_option ( SwitchSettingsUiEndpoint::OPTION_NAME_SHOULD_USE_OLD_UI );
7890
79- return apply_filters (
80- 'woocommerce_paypal_payments_should_use_the_old_ui ' ,
81- $ opt_out_choice
82- );
91+ return apply_filters ( 'woocommerce_paypal_payments_should_use_the_old_ui ' , $ opt_out );
8392 }
8493
8594 /**
You can’t perform that action at this time.
0 commit comments