Skip to content

Commit fb49207

Browse files
authored
Make ECE feature flag enabled by default for new accounts only (#3596)
* enable ece feature flag by default for new accounts only * add changelog * call the method
1 parent d77461f commit fb49207

File tree

4 files changed

+17
-3
lines changed

4 files changed

+17
-3
lines changed

changelog.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
* Fix - Hide express checkout when credit card payments are not enabled.
55
* Fix - Fix issues when detaching payment methods on staging sites (with the new checkout experience enabled).
66
* Fix - Display a notice if taxes vary by customer's billing address when checking out using the Stripe Express Checkout Element.
7-
* Tweak - Makes the new Stripe Express Checkout Element enabled by default.
7+
* Tweak - Makes the new Stripe Express Checkout Element enabled by default in new accounts.
88
* Dev - Add multiple unit tests for the Stripe Express Checkout Element implementation (for both frontend and backend).
99
* Fix - Check if taxes are enabled when applying ECE tax compatibility check.
1010
* Fix - Fix ECE error when initial address on load is not defined as a shipping zone.

includes/class-wc-stripe-feature-flags.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ class WC_Stripe_Feature_Flags {
1414
* @return bool
1515
*/
1616
public static function is_stripe_ece_enabled() {
17-
return 'yes' === get_option( self::ECE_FEATURE_FLAG_NAME, 'yes' );
17+
return 'yes' === get_option( self::ECE_FEATURE_FLAG_NAME, 'no' );
1818
}
1919

2020
/**

includes/connect/class-wc-stripe-connect.php

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -173,6 +173,9 @@ private function save_stripe_keys( $result, $type = 'connect', $mode = 'live' )
173173
unset( $options['account_id'] );
174174
unset( $options['test_account_id'] );
175175

176+
// Enable ECE for new connections.
177+
$this->enable_ece_in_new_accounts();
178+
176179
WC_Stripe_Helper::update_main_stripe_settings( $options );
177180

178181
// Similar to what we do for webhooks, we save some stats to help debug oauth problems.
@@ -213,6 +216,17 @@ private function get_upe_checkout_experience_enabled() {
213216
return 'yes';
214217
}
215218

219+
/**
220+
* Enable Stripe express checkout element for new connections.
221+
*/
222+
private function enable_ece_in_new_accounts() {
223+
$existing_stripe_settings = WC_Stripe_Helper::get_stripe_settings();
224+
225+
if ( empty( $existing_stripe_settings ) ) {
226+
update_option( WC_Stripe_Feature_Flags::ECE_FEATURE_FLAG_NAME, 'yes' );
227+
}
228+
}
229+
216230
/**
217231
* Gets default Stripe settings
218232
*/

readme.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ If you get stuck, you can ask for help in the [Plugin Forum](https://wordpress.o
114114
* Fix - Hide express checkout when credit card payments are not enabled.
115115
* Fix - Fix issues when detaching payment methods on staging sites (with the new checkout experience enabled).
116116
* Fix - Display a notice if taxes vary by customer's billing address when checking out using the Stripe Express Checkout Element.
117-
* Tweak - Makes the new Stripe Express Checkout Element enabled by default.
117+
* Tweak - Makes the new Stripe Express Checkout Element enabled by default in new accounts.
118118
* Dev - Add multiple unit tests for the Stripe Express Checkout Element implementation (for both frontend and backend).
119119
* Fix - Check if taxes are enabled when applying ECE tax compatibility check.
120120
* Fix - Fix ECE error when initial address on load is not defined as a shipping zone.

0 commit comments

Comments
 (0)