diff --git a/changelog/fix-upe-country-selection b/changelog/fix-upe-country-selection new file mode 100644 index 00000000000..478ffa1cfcd --- /dev/null +++ b/changelog/fix-upe-country-selection @@ -0,0 +1,4 @@ +Significance: patch +Type: fix + +Fixed UPE country detection in Checkout for non-logged in users diff --git a/client/checkout/utils/upe.js b/client/checkout/utils/upe.js index 500314b9f5b..af8e0427c04 100644 --- a/client/checkout/utils/upe.js +++ b/client/checkout/utils/upe.js @@ -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 ) ) {