Skip to content

Commit 8ddd5ad

Browse files
authored
Check order currency on pay for order page to display supported payment methods (#3678)
* check order currency on pay for order page to display available payment methods * add changelog * use is_wc_endpoint_url function
1 parent fd1ab0a commit 8ddd5ad

File tree

3 files changed

+14
-3
lines changed

3 files changed

+14
-3
lines changed

changelog.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
* Tweak - Add empty check for cart when checking for allowed products for express checkout.
2525
* Update - Prevent editing of orders awaiting payment capture.
2626
* Add - Introduce locking and unlocking in refund flow to prevent double refund due to race condition.
27+
* Fix - Check order currency on pay for order page to display supported payment methods.
2728

2829
= 9.0.0 - 2024-12-12 =
2930
* Fix - Fix 404 that happens when using ECE and 3D Secure auth is triggered.

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

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -230,11 +230,20 @@ public function is_enabled_at_checkout( $order_id = null, $account_domestic_curr
230230
return false;
231231
}
232232

233-
// Check currency compatibility.
233+
// Check currency compatibility. On the pay for order page, check the order currency.
234+
// Otherwise, check the store currency.
234235
$current_store_currency = $this->get_woocommerce_currency();
235236
$currencies = $this->get_supported_currencies();
236-
if ( ! empty( $currencies ) && ! in_array( $current_store_currency, $currencies, true ) ) {
237-
return false;
237+
if ( ! empty( $currencies ) ) {
238+
if ( is_wc_endpoint_url( 'order-pay' ) && isset( $_GET['key'] ) ) {
239+
$order = wc_get_order( $order_id ? $order_id : absint( get_query_var( 'order-pay' ) ) );
240+
$order_currency = $order->get_currency();
241+
if ( ! in_array( $order_currency, $currencies, true ) ) {
242+
return false;
243+
}
244+
} else if ( ! in_array( $current_store_currency, $currencies, true ) ) {
245+
return false;
246+
}
238247
}
239248

240249
// For payment methods that only support domestic payments, check if the store currency matches the account's default currency.

readme.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -134,5 +134,6 @@ If you get stuck, you can ask for help in the [Plugin Forum](https://wordpress.o
134134
* Tweak - Add empty check for cart when checking for allowed products for express checkout.
135135
* Update - Prevent editing of orders awaiting payment capture.
136136
* Add - Introduce locking and unlocking in refund flow to prevent double refund due to race condition.
137+
* Fix - Check order currency on pay for order page to display supported payment methods.
137138

138139
[See changelog for all versions](https://raw.githubusercontent.com/woocommerce/woocommerce-gateway-stripe/trunk/changelog.txt).

0 commit comments

Comments
 (0)