Skip to content

Commit abe8e05

Browse files
authored
Fix payment method instructions for OC (#4575)
* Fix payment method instructions for OC * Changelog and readme entries * Fix instructions showing up quickly during page load
1 parent f17b935 commit abe8e05

File tree

4 files changed

+28
-2
lines changed

4 files changed

+28
-2
lines changed

changelog.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
*** Changelog ***
22

33
= 9.9.0 - xxxx-xx-xx =
4+
* Fix - Payment method test instructions not showing up for the Optimized Checkout payment element
45
* Add - Includes a new notice to highlight the Optimized Checkout feature above the payment methods list in the Stripe settings page
56
* Update - Increases the default font size for the Optimized Checkout payment element to match the rest of the checkout form
67
* Fix - Checks for the subscription payment method (if it is Stripe) when verifying for the payment method detachment

client/blocks/upe/styles.scss

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ button.stripe-gateway-stripelink-modal-trigger:hover {
2727
#radio-control-wc-payment-method-options-stripe__content.optimized-checkout-element {
2828
padding-top: 1.4em;
2929

30-
.content {
30+
.content:empty {
3131
display: none;
3232
}
3333
}

includes/payment-methods/class-wc-stripe-upe-payment-gateway.php

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -262,6 +262,16 @@ public function __construct() {
262262

263263
// Hide action buttons for pending orders if they take a while to be confirmed.
264264
add_filter( 'woocommerce_my_account_my_orders_actions', [ $this, 'filter_my_account_my_orders_actions' ], 10, 2 );
265+
266+
// For the Optimized Checkout, allow the display property in inline styles to hide payment method instructions (see `get_testing_instructions_for_optimized_checkout`).
267+
if ( $this->oc_enabled ) {
268+
add_filter(
269+
'safe_style_css',
270+
function ( $styles ) {
271+
return array_merge( $styles, [ 'display' ] );
272+
}
273+
);
274+
}
265275
}
266276

267277
/**
@@ -760,7 +770,21 @@ public function payment_fields() {
760770
<?php
761771
if ( $this->testmode ) :
762772
if ( $this->oc_enabled ) :
763-
echo wp_kses_post( self::get_testing_instructions_for_optimized_checkout() );
773+
echo wp_kses(
774+
self::get_testing_instructions_for_optimized_checkout(),
775+
[
776+
'div' => [
777+
'id' => [],
778+
'class' => [],
779+
'style' => [],
780+
],
781+
'strong' => [],
782+
'a' => [
783+
'href' => [],
784+
'target' => [],
785+
],
786+
]
787+
);
764788
else :
765789
?>
766790
<p class="testmode-info">

readme.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,7 @@ If you get stuck, you can ask for help in the [Plugin Forum](https://wordpress.o
111111
== Changelog ==
112112

113113
= 9.9.0 - xxxx-xx-xx =
114+
* Fix - Payment method test instructions not showing up for the Optimized Checkout payment element
114115
* Add - Includes a new notice to highlight the Optimized Checkout feature above the payment methods list in the Stripe settings page
115116
* Update - Increases the default font size for the Optimized Checkout payment element to match the rest of the checkout form
116117
* Fix - Checks for the subscription payment method (if it is Stripe) when verifying for the payment method detachment

0 commit comments

Comments
 (0)