Skip to content

Commit 5fe749e

Browse files
committed
fix(checkout): use country name instead of code in "same as shipping"
1 parent 6d41335 commit 5fe749e

File tree

2 files changed

+13
-6
lines changed

2 files changed

+13
-6
lines changed

packages/theme/modules/checkout/pages/Checkout/Billing.vue

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,11 @@
2626
...billingDetails,
2727
region: { region_code: billingDetails.region },
2828
}"
29-
/>
29+
>
30+
<template #country>
31+
{{ shippingDetailsCountryName }}
32+
</template>
33+
</UserAddressDetails>
3034
</div>
3135
</div>
3236
</div>
@@ -360,6 +364,11 @@ export default defineComponent({
360364
361365
const countries = ref<Country[]>([]);
362366
const country = ref<Country | null>(null);
367+
368+
const shippingDetailsCountryName = computed(() => countries
369+
.value
370+
.find((countryItem) => countryItem.id === shippingDetails.value?.country.code)?.full_name_locale ?? '');
371+
363372
const { isAuthenticated } = useUser();
364373
let oldBilling : CheckoutAddressForm | null = null;
365374
const sameAsShipping = ref(false);
@@ -481,13 +490,10 @@ export default defineComponent({
481490
const [defaultAddress = null] = userBillingGetters.getAddresses(loadedUserBilling, { default_shipping: true });
482491
const wasBillingAddressAlreadySetOnCart = Boolean(loadedBillingInfoBoundToCart);
483492
484-
<<<<<<< HEAD
485-
=======
486493
// keep in mind default billing address is set on a customer's cart during cart creation
487-
>>>>>>> 8578149e (chore: fix commit wording)
488494
if (wasBillingAddressAlreadySetOnCart) {
489495
const userAddressIdenticalToSavedCartAddress = findUserAddressIdenticalToSavedCartAddress(
490-
loadedUserBilling.addresses,
496+
loadedUserBilling?.addresses,
491497
loadedBillingInfoBoundToCart,
492498
);
493499
@@ -523,6 +529,7 @@ export default defineComponent({
523529
setAsDefault,
524530
billingDetails,
525531
sameAsShipping,
532+
shippingDetailsCountryName,
526533
addresses,
527534
};
528535
},

packages/theme/modules/checkout/pages/Checkout/Shipping.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -428,7 +428,7 @@ export default defineComponent({
428428
429429
if (wasShippingAddressAlreadySetOnCart) {
430430
const userAddressIdenticalToSavedCartAddress = findUserAddressIdenticalToSavedCartAddress(
431-
loadedUserShipping.addresses,
431+
loadedUserShipping?.addresses,
432432
loadedShippingInfoBoundToCart,
433433
);
434434
handleSetCurrentAddress({ ...loadedShippingInfoBoundToCart, id: userAddressIdenticalToSavedCartAddress?.id });

0 commit comments

Comments
 (0)