Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed UPE country detection in Checkout for non-logged in users #9912

Merged
merged 2 commits into from
Dec 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions changelog/fix-upe-country-selection
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Significance: patch
Type: fix

Fixed UPE country detection in Checkout for non-logged in users
3 changes: 1 addition & 2 deletions client/checkout/utils/upe.js
Original file line number Diff line number Diff line change
Expand Up @@ -375,10 +375,9 @@ export const togglePaymentMethodForCountry = ( upeElement ) => {
billingInput = document.querySelector( '#billing_country' );
}

/* global wcpayCustomerData */
// in the case of "pay for order", there is no "billing country" input, so we need to rely on backend data.
const billingCountry =
billingInput?.value || wcpayCustomerData?.billing_country || '';
billingInput?.value || window?.wcpayCustomerData?.billing_country || '';

const upeContainer = upeElement?.closest( '.wc_payment_method' );
if ( supportedCountries.includes( billingCountry ) ) {
Expand Down
Loading