Skip to content

Commit 2a4e975

Browse files
committed
Merge release/8.2.1 into trunk
2 parents 33903e4 + b962d27 commit 2a4e975

File tree

7 files changed

+22
-39
lines changed

7 files changed

+22
-39
lines changed

changelog.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
*** WooPayments Changelog ***
22

3+
= 8.2.1 - 2024-09-13 =
4+
* Fix - Create div container element with JS dynamically.
5+
36
= 8.2.0 - 2024-09-11 =
47
* Add - add: test instructions icon animation
58
* Add - Added Embdedded KYC, currently behind feature flag.

client/express-checkout/utils/checkPaymentMethodIsAvailable.js

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,15 @@ import { getUPEConfig } from 'wcpay/utils/checkout';
1515

1616
export const checkPaymentMethodIsAvailable = memoize(
1717
( paymentMethod, cart, resolve ) => {
18-
const root = ReactDOM.createRoot(
19-
document.getElementById(
20-
`express-checkout-check-availability-container-${ paymentMethod }`
21-
)
22-
);
18+
// Create the DIV container on the fly
19+
const containerEl = document.createElement( 'div' );
20+
21+
// Ensure the element is hidden and doesn’t interfere with the page layout.
22+
containerEl.style.display = 'none';
23+
24+
document.querySelector( 'body' ).appendChild( containerEl );
25+
26+
const root = ReactDOM.createRoot( containerEl );
2327

2428
const api = new WCPayAPI(
2529
{
@@ -71,6 +75,7 @@ export const checkPaymentMethodIsAvailable = memoize(
7175
}
7276
resolve( canMakePayment );
7377
root.unmount();
78+
containerEl.remove();
7479
} }
7580
/>
7681
</Elements>

includes/express-checkout/class-wc-payments-express-checkout-button-display-handler.php

Lines changed: 0 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -95,10 +95,6 @@ public function init() {
9595
$is_woopay_enabled = WC_Payments_Features::is_woopay_enabled();
9696
$is_payment_request_enabled = 'yes' === $this->gateway->get_option( 'payment_request' );
9797

98-
if ( $is_payment_request_enabled ) {
99-
$this->add_html_container_for_test_express_checkout_buttons();
100-
}
101-
10298
if ( $is_woopay_enabled || $is_payment_request_enabled ) {
10399
add_action( 'wc_ajax_wcpay_add_to_cart', [ $this->express_checkout_ajax_handler, 'ajax_add_to_cart' ] );
104100
add_action( 'wc_ajax_wcpay_empty_cart', [ $this->express_checkout_ajax_handler, 'ajax_empty_cart' ] );
@@ -178,31 +174,6 @@ public function add_order_attribution_inputs() {
178174
echo '<wc-order-attribution-inputs id="wcpay-express-checkout__order-attribution-inputs"></wc-order-attribution-inputs>';
179175
}
180176

181-
182-
/**
183-
* Add HTML containers to be used by the Express Checkout buttons that check if the payment method is available.
184-
*
185-
* @return void
186-
*/
187-
private function add_html_container_for_test_express_checkout_buttons() {
188-
add_filter(
189-
'the_content',
190-
function ( $content ) {
191-
$supported_payment_methods = [ 'applePay' , 'googlePay' ];
192-
// Restrict adding these HTML containers to only the necessary pages.
193-
if ( $this->express_checkout_helper->is_checkout() || $this->express_checkout_helper->is_cart() ) {
194-
foreach ( $supported_payment_methods as $value ) {
195-
// The inline styles ensure that the HTML elements don't occupy space on the page.
196-
$content = '<div id="express-checkout-check-availability-container-' . $value . '" style="height: 0; float:left; opacity: 0; pointer-events: none;"></div>' . $content;
197-
}
198-
}
199-
return $content;
200-
},
201-
10,
202-
1
203-
);
204-
}
205-
206177
/**
207178
* Check if the pay-for-order flow is supported.
208179
*

package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "woocommerce-payments",
3-
"version": "8.2.0",
3+
"version": "8.2.1",
44
"main": "webpack.config.js",
55
"author": "Automattic",
66
"license": "GPL-3.0-or-later",

readme.txt

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ Tags: woocommerce payments, apple pay, credit card, google pay, payment, payment
44
Requires at least: 6.0
55
Tested up to: 6.6
66
Requires PHP: 7.3
7-
Stable tag: 8.2.0
7+
Stable tag: 8.2.1
88
License: GPLv2 or later
99
License URI: http://www.gnu.org/licenses/gpl-2.0.html
1010

@@ -94,6 +94,10 @@ Please note that our support for the checkout block is still experimental and th
9494

9595
== Changelog ==
9696

97+
= 8.2.1 - 2024-09-13 =
98+
* Fix - Create div container element with JS dynamically.
99+
100+
97101
= 8.2.0 - 2024-09-11 =
98102
* Add - add: test instructions icon animation
99103
* Add - Added Embdedded KYC, currently behind feature flag.

woocommerce-payments.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
* WC tested up to: 9.2.0
1212
* Requires at least: 6.0
1313
* Requires PHP: 7.3
14-
* Version: 8.2.0
14+
* Version: 8.2.1
1515
* Requires Plugins: woocommerce
1616
*
1717
* @package WooCommerce\Payments

0 commit comments

Comments
 (0)