Skip to content

Commit

Permalink
Fix phone number input on checkout (#6955)
Browse files Browse the repository at this point in the history
Co-authored-by: Dan Paun <dan.paun@automattic.com>
  • Loading branch information
dpaun1985 and Dan Paun authored Aug 9, 2023
1 parent 47dc8d9 commit 007e647
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 10 deletions.
4 changes: 4 additions & 0 deletions changelog/fix-6952-fix-phonenumberinput
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Significance: patch
Type: fix

Fix phone number input widget on checkout page
22 changes: 12 additions & 10 deletions client/settings/phone-input/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -75,16 +75,18 @@ const PhoneNumberInput = ( {
onlyCountries: [],
};

const accountCountry = wcpaySettings?.accountStatus?.country ?? '';

// Special case for Japan: Only Japanese phone numbers are accepted by Stripe
if ( accountCountry === 'JP' ) {
phoneCountries = {
initialCountry: 'JP',
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
onlyCountries: [ 'JP' ],
};
//if in admin panel
if ( 'undefined' !== typeof wcpaySettings ) {
const accountCountry = wcpaySettings?.accountStatus?.country ?? '';
// Special case for Japan: Only Japanese phone numbers are accepted by Stripe
if ( accountCountry === 'JP' ) {
phoneCountries = {
initialCountry: 'JP',
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
onlyCountries: [ 'JP' ],
};
}
}

if ( currentRef ) {
Expand Down

0 comments on commit 007e647

Please sign in to comment.