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

Only throw missing Billing State error if required by checkout's country group #6435

Merged
merged 3 commits into from
Oct 22, 2024
Merged
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
8 changes: 6 additions & 2 deletions support-frontend/assets/pages/[countryGroupId]/checkout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,7 @@ import {
*/
type PaymentMethod = LegacyPaymentMethod | 'StripeExpressCheckoutElement';
const countryId: IsoCountry = CountryHelper.detect();
const countriesRequiringBillingState = ['US', 'CA', 'AU'];

function paymentMethodIsActive(paymentMethod: LegacyPaymentMethod) {
return isSwitchOn(
Expand Down Expand Up @@ -1172,7 +1173,10 @@ function CheckoutComponent({
event.billingDetails.address.postal_code,
);

if (!event.billingDetails?.address.state) {
if (
!event.billingDetails?.address.state &&
countriesRequiringBillingState.includes(countryId)
) {
logException(
"Could not find state from Stripe's billingDetails",
{ geoId, countryGroupId, countryId },
Expand Down Expand Up @@ -1347,7 +1351,7 @@ function CheckoutComponent({
* We require state for non-deliverable products as we use different taxes within those regions upstream
* For deliverable products we take the state and zip code with the delivery address
*/}
{['US', 'CA', 'AU'].includes(countryId) &&
{countriesRequiringBillingState.includes(countryId) &&
!productDescription.deliverableTo && (
<StateSelect
countryId={countryId}
Expand Down
Loading