Skip to content

Commit a554ea6

Browse files
committed
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 80121ba commit a554ea6

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
@@ -4,6 +4,7 @@
44
* Fix - Remove connection type requirement from PMC sync migration attempt
55
* Fix - Relax customer validation that was preventing payments from the pay for order page
66
* Fix - Prevent the PMC migration to run when the plugin is not connected to Stripe
7+
* Fix - Fixes a fatal error in the OC inbox note when the new checkout is disabled
78

89
= 9.8.0 - 2025-08-11 =
910
* 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
@@ -277,7 +277,7 @@ public function admin_scripts( $hook_suffix ) {
277277
'account_country' => $this->account->get_account_country(),
278278
'are_apms_deprecated' => WC_Stripe_Feature_Flags::are_apms_deprecated(),
279279
'is_amazon_pay_available' => WC_Stripe_Feature_Flags::is_amazon_pay_available(),
280-
'is_oc_available' => WC_Stripe_Feature_Flags::is_oc_available(),
280+
'is_oc_available' => WC_Stripe_Feature_Flags::is_oc_available() && WC_Stripe_Feature_Flags::is_upe_checkout_enabled(),
281281
'is_oc_enabled' => $is_oc_enabled,
282282
'oauth_nonce' => wp_create_nonce( 'wc_stripe_get_oauth_urls' ),
283283
'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
@@ -117,6 +117,7 @@ If you get stuck, you can ask for help in the [Plugin Forum](https://wordpress.o
117117
* Fix - Remove connection type requirement from PMC sync migration attempt
118118
* Fix - Relax customer validation that was preventing payments from the pay for order page
119119
* Fix - Prevent the PMC migration to run when the plugin is not connected to Stripe
120+
* Fix - Fixes a fatal error in the OC inbox note when the new checkout is disabled
120121

121122
= 9.8.0 - 2025-08-11 =
122123

0 commit comments

Comments
 (0)