-
Notifications
You must be signed in to change notification settings - Fork 119
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
fix: billing address overwrites shipping address when copy flag is set #510
Merged
Frodigo
merged 5 commits into
develop
from
bug/m2-103-Billing-address-overwrites-shipping-address-when-copy-flag-is-set
Jan 28, 2022
Merged
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
7efeb56
fix(theme): don't redirect with empty cart on thank-you step during t…
KevinGorjan 024b4e2
fix(theme): fix on billing step when address for shipping and billing…
KevinGorjan 830d9ec
chore: merge develop into current branch
KevinGorjan 41b9ab3
chore: merge develop into current branch
KevinGorjan fe56b7d
chore(theme): added missing translations
KevinGorjan File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,23 +9,30 @@ | |
<form | ||
@submit.prevent="handleSubmit(handleAddressSubmit(reset))" | ||
> | ||
<UserBillingAddresses | ||
v-if="isAuthenticated && hasSavedBillingAddress" | ||
v-model="setAsDefault" | ||
v-e2e="'billing-addresses'" | ||
:current-address-id="currentAddressId || NOT_SELECTED_ADDRESS" | ||
@setCurrentAddress="handleSetCurrentAddress" | ||
/> | ||
<SfCheckbox | ||
v-e2e="'copy-address'" | ||
:selected="sameAsShipping" | ||
label="Copy address data from shipping" | ||
:label="$t('My billing and shipping address are the same')" | ||
name="copyShippingAddress" | ||
class="form__element" | ||
@change="handleCheckSameAddress" | ||
/> | ||
<div v-if="sameAsShipping" class="copy__shipping__addresses"> | ||
<div class="copy__shipping__address"> | ||
<div class="sf-address"> | ||
<UserAddressDetails :address="{... billingDetails, region: {region_code: billingDetails.region}}" /> | ||
</div> | ||
</div> | ||
</div> | ||
<UserBillingAddresses | ||
v-if="!sameAsShipping && isAuthenticated && hasSavedBillingAddress" | ||
v-model="setAsDefault" | ||
v-e2e="'billing-addresses'" | ||
:current-address-id="currentAddressId || NOT_SELECTED_ADDRESS" | ||
@setCurrentAddress="handleSetCurrentAddress" | ||
/> | ||
<div | ||
v-if="canAddNewAddress" | ||
v-if="!sameAsShipping && canAddNewAddress" | ||
class="form" | ||
> | ||
<ValidationProvider | ||
|
@@ -222,7 +229,7 @@ | |
</ValidationProvider> | ||
</div> | ||
<SfButton | ||
v-if="!canAddNewAddress" | ||
v-if="!sameAsShipping && !canAddNewAddress" | ||
class="color-light form__action-button form__action-button--add-address" | ||
type="submit" | ||
@click="handleAddNewAddressBtnClick" | ||
|
@@ -243,7 +250,7 @@ | |
to="localePath('/checkout/shipping')" | ||
class="sf-button sf-button--underlined form__back-button smartphone-only" | ||
> | ||
Go back | ||
{{ $t('Go back') }} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. PLease double-check if the translation for that phrase exists in de.js file. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Added |
||
</nuxt-link> | ||
</div> | ||
</div> | ||
|
@@ -259,6 +266,7 @@ import { | |
SfSelect, | ||
SfCheckbox, | ||
} from '@storefront-ui/vue'; | ||
import UserAddressDetails from '~/components/UserAddressDetails.vue'; | ||
import { | ||
useUserBilling, | ||
userBillingGetters, | ||
|
@@ -309,6 +317,7 @@ export default defineComponent({ | |
ValidationProvider, | ||
ValidationObserver, | ||
UserBillingAddresses: () => import('~/components/Checkout/UserBillingAddresses.vue'), | ||
UserAddressDetails, | ||
}, | ||
setup() { | ||
const router = useRouter(); | ||
|
@@ -398,7 +407,6 @@ export default defineComponent({ | |
oldBilling = { ...billingDetails.value }; | ||
billingDetails.value = { ...formatAddressReturnToData(shippingDetails.value) }; | ||
currentAddressId.value = NOT_SELECTED_ADDRESS; | ||
canAddNewAddress.value = true; | ||
setAsDefault.value = false; | ||
if (billingDetails.value.country_code) { | ||
await searchCountry({ id: billingDetails?.value.country_code }); | ||
|
@@ -519,6 +527,29 @@ export default defineComponent({ | |
--heading-title-font-weight: var(--font-weight--bold); | ||
} | ||
.copy__shipping { | ||
&__address { | ||
margin-bottom: var(--spacer-xs); | ||
@include for-desktop { | ||
margin-right: var(--spacer-sm); | ||
display: flex; | ||
width: 100%; | ||
flex-direction: column; | ||
} | ||
.sf-address { | ||
padding: var(--spacer-xs); | ||
} | ||
} | ||
&__addresses { | ||
margin-bottom: var(--spacer-xl); | ||
@include for-desktop { | ||
display: flex; | ||
} | ||
} | ||
} | ||
.form { | ||
&__select { | ||
display: flex; | ||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please add a german translation for that to de.js file in the lang directory.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added