Skip to content

Commit

Permalink
Merge pull request #5952 from guardian/billing-address-country
Browse files Browse the repository at this point in the history
fix: add billing-address country to non-deliverable products
  • Loading branch information
jamesgorrie authored Apr 24, 2024
2 parents 7694cca + 91f9ec3 commit c2408ed
Showing 1 changed file with 16 additions and 3 deletions.
19 changes: 16 additions & 3 deletions support-frontend/assets/pages/[countryGroupId]/checkout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -408,7 +408,7 @@ export function Checkout() {
city: formData.get('delivery-city') as string,
state: formData.get('delivery-state') as string,
postCode: formData.get('delivery-postcode') as string,
country: formData.get('country') as IsoCountry,
country: formData.get('delivery-country') as IsoCountry,
};

const billingAddressMatchesDelivery =
Expand All @@ -421,11 +421,13 @@ export function Checkout() {
city: formData.get('billing-city') as string,
state: formData.get('billing-state') as string,
postCode: formData.get('billing-postcode') as string,
country: formData.get('country') as IsoCountry,
country: formData.get('billing-country') as IsoCountry,
}
: deliveryAddress;
} else {
billingAddress = { country: formData.get('country') as IsoCountry };
billingAddress = {
country: formData.get('billing-country') as IsoCountry,
};
deliveryAddress = undefined;
}

Expand Down Expand Up @@ -616,6 +618,17 @@ export function Checkout() {

<CheckoutDivider spacing="loose" />

{/**
* We need the billing-country for all transactions, even non-deliverable ones
* which we get from the GU_country cookie which comes from the Fastly geo client.
*/}
{!productDescription.deliverableTo && (
<input
type="hidden"
name="billing-country"
value={countryId}
/>
)}
{productDescription.deliverableTo && (
<>
<fieldset>
Expand Down

0 comments on commit c2408ed

Please sign in to comment.