From ba73d6e20114a1be4a3a50991f0c8b71671b589d Mon Sep 17 00:00:00 2001 From: Wesley Rosa Date: Tue, 12 Aug 2025 10:21:46 -0300 Subject: [PATCH 1/3] Fix payment method instructions for OC --- client/blocks/upe/styles.scss | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/client/blocks/upe/styles.scss b/client/blocks/upe/styles.scss index 6df02034c0..8ac69a5a19 100644 --- a/client/blocks/upe/styles.scss +++ b/client/blocks/upe/styles.scss @@ -27,7 +27,7 @@ button.stripe-gateway-stripelink-modal-trigger:hover { #radio-control-wc-payment-method-options-stripe__content.optimized-checkout-element { padding-top: 1.4em; - .content { + .content:empty { display: none; } } From 8a0dfffbdf956fa49859fa364953ce44fd6c0bbe Mon Sep 17 00:00:00 2001 From: Wesley Rosa Date: Tue, 12 Aug 2025 10:23:49 -0300 Subject: [PATCH 2/3] Changelog and readme entries --- changelog.txt | 1 + readme.txt | 1 + 2 files changed, 2 insertions(+) diff --git a/changelog.txt b/changelog.txt index f4d09c1c31..e2906f8a66 100644 --- a/changelog.txt +++ b/changelog.txt @@ -1,6 +1,7 @@ *** Changelog *** = 9.8.0 - xxxx-xx-xx = +* Fix - Payment method test instructions not showing up for the Optimized Checkout payment element * Add - Includes a new notice to highlight the Optimized Checkout feature above the payment methods list in the Stripe settings page * Update - Increases the default font size for the Optimized Checkout payment element to match the rest of the checkout form * Fix - Checks for the subscription payment method (if it is Stripe) when verifying for the payment method detachment diff --git a/readme.txt b/readme.txt index 4ff9a70767..e80294d2e6 100644 --- a/readme.txt +++ b/readme.txt @@ -111,6 +111,7 @@ If you get stuck, you can ask for help in the [Plugin Forum](https://wordpress.o == Changelog == = 9.8.0 - xxxx-xx-xx = +* Fix - Payment method test instructions not showing up for the Optimized Checkout payment element * Add - Includes a new notice to highlight the Optimized Checkout feature above the payment methods list in the Stripe settings page * Update - Increases the default font size for the Optimized Checkout payment element to match the rest of the checkout form * Fix - Checks for the subscription payment method (if it is Stripe) when verifying for the payment method detachment From 3c6e6563b5a4e5e44fb7e02d9dcc08859fe60199 Mon Sep 17 00:00:00 2001 From: Wesley Rosa Date: Thu, 14 Aug 2025 16:56:29 -0300 Subject: [PATCH 3/3] Fix instructions showing up quickly during page load --- .../class-wc-stripe-upe-payment-gateway.php | 26 ++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) diff --git a/includes/payment-methods/class-wc-stripe-upe-payment-gateway.php b/includes/payment-methods/class-wc-stripe-upe-payment-gateway.php index 65bdc565f7..d8a56e3c41 100644 --- a/includes/payment-methods/class-wc-stripe-upe-payment-gateway.php +++ b/includes/payment-methods/class-wc-stripe-upe-payment-gateway.php @@ -262,6 +262,16 @@ public function __construct() { // Hide action buttons for pending orders if they take a while to be confirmed. add_filter( 'woocommerce_my_account_my_orders_actions', [ $this, 'filter_my_account_my_orders_actions' ], 10, 2 ); + + // For the Optimized Checkout, allow the display property in inline styles to hide payment method instructions (see `get_testing_instructions_for_optimized_checkout`). + if ( $this->oc_enabled ) { + add_filter( + 'safe_style_css', + function ( $styles ) { + return array_merge( $styles, [ 'display' ] ); + } + ); + } } /** @@ -760,7 +770,21 @@ public function payment_fields() { testmode ) : if ( $this->oc_enabled ) : - echo wp_kses_post( self::get_testing_instructions_for_optimized_checkout() ); + echo wp_kses( + self::get_testing_instructions_for_optimized_checkout(), + [ + 'div' => [ + 'id' => [], + 'class' => [], + 'style' => [], + ], + 'strong' => [], + 'a' => [ + 'href' => [], + 'target' => [], + ], + ] + ); else : ?>