Skip to content

Commit 396d604

Browse files
authored
Fix Optimized Checkout note generating an E_ERROR when the new checkout is disabled (#4594)
* Add fallback is_oc_enabled() implementation to the base gateway * Fix endless re-render in the settings page
1 parent 624c8fe commit 396d604

File tree

4 files changed

+16
-1
lines changed

4 files changed

+16
-1
lines changed

changelog.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
* Fix - Remove connection type requirement from PMC sync migration attempt
1313
* Tweak - Small improvements to e2e tests
1414
* Fix - Prevent the PMC migration to run when the plugin is not connected to Stripe
15+
* Fix - Fixes a fatal error in the OC inbox note when the new checkout is disabled
1516

1617
= 9.8.0 - 2025-08-11 =
1718
* Add - Adds the current setting value for the Optimized Checkout to the Stripe System Status Report data

includes/admin/class-wc-stripe-settings-controller.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -278,7 +278,7 @@ public function admin_scripts( $hook_suffix ) {
278278
'account_country' => $this->account->get_account_country(),
279279
'are_apms_deprecated' => WC_Stripe_Feature_Flags::are_apms_deprecated(),
280280
'is_amazon_pay_available' => WC_Stripe_Feature_Flags::is_amazon_pay_available(),
281-
'is_oc_available' => WC_Stripe_Feature_Flags::is_oc_available(),
281+
'is_oc_available' => WC_Stripe_Feature_Flags::is_oc_available() && WC_Stripe_Feature_Flags::is_upe_checkout_enabled(),
282282
'is_oc_enabled' => $is_oc_enabled,
283283
'oauth_nonce' => wp_create_nonce( 'wc_stripe_get_oauth_urls' ),
284284
'is_sepa_tokens_enabled' => 'yes' === $this->gateway->get_option( 'sepa_tokens_for_other_methods', 'no' ),

includes/class-wc-gateway-stripe.php

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1230,4 +1230,17 @@ private function validate_field( $field_key, $field_value ) {
12301230
public function is_payment_request_enabled() {
12311231
return 'yes' === $this->get_option( 'payment_request' );
12321232
}
1233+
1234+
/**
1235+
* Checks if the Optimized Checkout setting is enabled.
1236+
*
1237+
* OC is not supported in the legacy gateway, so we return false here,
1238+
* this method is then overridden by UPE payment gateway which extends from this class.
1239+
*
1240+
* @return bool Always false.
1241+
*/
1242+
public function is_oc_enabled() {
1243+
// Always return false here, as OC is not supported in the legacy gateway.
1244+
return false;
1245+
}
12331246
}

readme.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -122,5 +122,6 @@ If you get stuck, you can ask for help in the [Plugin Forum](https://wordpress.o
122122
* Fix - Remove connection type requirement from PMC sync migration attempt
123123
* Tweak - Small improvements to e2e tests
124124
* Fix - Prevent the PMC migration to run when the plugin is not connected to Stripe
125+
* Fix - Fixes a fatal error in the OC inbox note when the new checkout is disabled
125126

126127
[See changelog for full details across versions](https://raw.githubusercontent.com/woocommerce/woocommerce-gateway-stripe/trunk/changelog.txt).

0 commit comments

Comments
 (0)