Skip to content

Commit

Permalink
Merge pull request #2620 from JKrupinski/bugfix/2610
Browse files Browse the repository at this point in the history
#2610 - 'Product added to cart' popup appears only once per product
  • Loading branch information
pkarw committed Mar 23, 2019
2 parents d9a3acf + 3654a4b commit dcd28fc
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 14 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
-

### Fixed
- Confirmation popup 'Product has beed added to cart' is displayed only once - @JKrupinski (#2610)
- Moved My Account options from Categories - @bartdominiak (#2612)

### Changed / Improved
Expand Down
25 changes: 11 additions & 14 deletions core/modules/cart/store/actions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -704,21 +704,18 @@ const actions: ActionTree<CartState, RootState> = {
rootStore.commit('cart/' + types.CART_DEL_NON_CONFIRMED_ITEM, { product: originalCartItem }, {root: true})
}
} else {
const isThisNewItemAddedToTheCart = (!originalCartItem || !originalCartItem.item_id)
if (isThisNewItemAddedToTheCart) {
let notificationData = {
type: 'success',
message: i18n.t('Product has been added to the cart!'),
action1: { label: i18n.t('OK') },
action2: null
}
if (!config.externalCheckout) { // if there is externalCheckout enabled we don't offer action to go to checkout as it can generate cart desync
notificationData.action2 = { label: i18n.t('Proceed to checkout'), action: () => {
context.dispatch('goToCheckout')
}}
}
rootStore.dispatch('notification/spawnNotification', notificationData)
let notificationData = {
type: 'success',
message: i18n.t('Product has been added to the cart!'),
action1: { label: i18n.t('OK') },
action2: null
}
if (!config.externalCheckout) { // if there is externalCheckout enabled we don't offer action to go to checkout as it can generate cart desync
notificationData.action2 = { label: i18n.t('Proceed to checkout'), action: () => {
context.dispatch('goToCheckout')
}}
}
rootStore.dispatch('notification/spawnNotification', notificationData)
}
},
toggleMicrocart ({ commit }) {
Expand Down

0 comments on commit dcd28fc

Please sign in to comment.