Skip to content

Commit b786b3e

Browse files
committed
fix: checkout province state code issue
- province/state will be now properly displayed on the shipping and billing steps
1 parent d90a076 commit b786b3e

File tree

12 files changed

+35
-19
lines changed

12 files changed

+35
-19
lines changed

packages/theme/helpers/checkout/address.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ export const addressFromApiToForm = (address: CustomerAddress | CartAddressInter
2525
apartment: address.street?.[1],
2626
city: address.city,
2727
region: (address as CustomerAddress)?.region?.region_code ?? (address as CartAddressInterface).region.code,
28-
country_code: (address as CustomerAddress)?.country_code ?? (address as CartAddressInterface).region.code,
28+
country_code: (address as CustomerAddress)?.country_code ?? (address as CartAddressInterface).country.code,
2929
postcode: address.postcode,
3030
telephone: address.telephone,
3131
});

packages/theme/lang/de.js

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ export default {
1515
"Back to home": "Zurück Zur Startseite",
1616
"Back to homepage": "Zurück zur Homepage",
1717
"Billing": "Abrechnung",
18-
"Billing Address": "Rechnungsadresse",
18+
"Billing address": "Rechnungsadresse",
1919
"Brand": "Marke",
2020
"Cancel": "Abbrechen",
2121
"Cart": "Warenkorb",
@@ -156,13 +156,14 @@ export default {
156156
"Set up newsletter": "Richten Sie Ihren Newsletter ein und wir senden Ihnen wöchentlich Informationen zu neuen Produkten und Trends aus den von Ihnen ausgewählten Bereichen",
157157
"Share your look": "Teile deinen Look",
158158
"Shipping": "Versand",
159-
"Shipping Address": "Lieferanschrift",
160-
"Shipping Details": "Versanddetails",
161-
"Shipping Method": "Versandart",
159+
"Shipping address": "Lieferanschrift",
160+
"Shipping details": "Versanddetails",
161+
"Shipping method": "Versandart",
162162
"Show":"Show",
163163
"show more": "mehr anzeigen",
164164
"Show on page": "Auf Seite anzeigen",
165165
"Sign in": "Einloggen",
166+
"Size guide": "Größentabelle",
166167
"Sign Up for Newsletter": "Anmeldung für Newsletter",
167168
"Sort by": "Sortieren nach",
168169
"Sort: Default": "Standard",

packages/theme/lang/en.js

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ export default {
1515
"Back to home": "Back to home",
1616
"Back to homepage": "Back to homepage",
1717
"Billing": "Billing",
18-
"Billing Address": "Billing Address",
18+
"Billing address": "Billing address",
1919
"Brand": "Brand",
2020
"Cancel": "Cancel",
2121
"Cart": "Cart",
@@ -151,13 +151,14 @@ export default {
151151
"Set up newsletter": "Set up your newsletter and we will send you information about new products and trends from the sections you selected every week.",
152152
"Share your look": "Share your look",
153153
"Shipping": "Shipping",
154-
"Shipping Address": "Shipping Address",
155-
"Shipping Details": "Shipping Details",
156-
"Shipping Method": "Shipping Method",
154+
"Shipping address": "Shipping address",
155+
"Shipping details": "Shipping details",
156+
"Shipping method": "Shipping method",
157157
"Show":"Show",
158158
"show more": "show more",
159159
"Show on page": "Show on page",
160160
"Sign in": "Sign in",
161+
"Size guide": "Size guide",
161162
"Sign Up for Newsletter": "Sign Up for Newsletter",
162163
"Sort by": "Sort by",
163164
"Sort: Default": "Default",

packages/theme/components/Checkout/CartPreview.vue renamed to packages/theme/modules/checkout/components/CartPreview.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ import { computed, ref, defineComponent } from '@nuxtjs/composition-api';
5656
import cartGetters from '~/modules/checkout/getters/cartGetters';
5757
import useCart from '~/modules/checkout/composables/useCart';
5858
import getShippingMethodPrice from '~/helpers/checkout/getShippingMethodPrice';
59-
import CouponCode from '../CouponCode.vue';
59+
import CouponCode from '../../../components/CouponCode.vue';
6060
6161
const CHARACTERISTICS = [
6262
{

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ import {
4444
} from '@nuxtjs/composition-api';
4545
import cartGetters from '~/modules/checkout/getters/cartGetters';
4646
import useCart from '~/modules/checkout/composables/useCart';
47-
import CartPreview from '~/components/Checkout/CartPreview.vue';
47+
import CartPreview from '~/modules/checkout/components/CartPreview.vue';
4848
4949
export default defineComponent({
5050
name: 'CheckoutPage',

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

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -334,7 +334,7 @@ export default defineComponent({
334334
SfCheckbox,
335335
ValidationProvider,
336336
ValidationObserver,
337-
UserBillingAddresses: () => import('~/components/Checkout/UserBillingAddresses.vue'),
337+
UserBillingAddresses: () => import('~/modules/checkout/components/UserBillingAddresses.vue'),
338338
UserAddressDetails,
339339
},
340340
setup() {
@@ -479,8 +479,15 @@ export default defineComponent({
479479
country.value = await searchCountry({ id });
480480
};
481481
482-
watch(billingAddress, (addr) => {
482+
watch(billingAddress, async (addr) => {
483483
billingDetails.value = addr ? addressFromApiToForm(addr) : getInitialCheckoutAddressForm();
484+
country.value = await searchCountry({ id: billingDetails.value.country_code });
485+
});
486+
487+
watch(country, (data) => {
488+
if (!data?.available_regions) {
489+
billingDetails.value.region = '';
490+
}
484491
});
485492
486493
onMounted(async () => {

0 commit comments

Comments
 (0)