Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions config/default.json
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,7 @@
}
},
"cart": {
"bypassCartLoaderForAuthorizedUsers": true,
"multisiteCommonCart": true,
"server_merge_by_default": true,
"synchronize": true,
Expand Down
5 changes: 1 addition & 4 deletions core/store/modules/cart/actions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -111,9 +111,6 @@ const actions: ActionTree<CartState, RootState> = {
serverCreate (context, { guestCart = false }) {
if (rootStore.state.config.cart.synchronize && !Vue.prototype.$isServer) {
if ((Date.now() - context.state.cartServerCreatedAt) >= CART_CREATE_INTERVAL_MS) {
if (guestCart) {
Vue.prototype.$db.usersCollection.setItem('last-cart-bypass-ts', new Date().getTime())
}
const task = { url: guestCart ? rootStore.state.config.cart.create_endpoint.replace('{{token}}', '') : rootStore.state.config.cart.create_endpoint, // sync the cart
payload: {
method: 'POST',
Expand Down Expand Up @@ -467,7 +464,7 @@ const actions: ActionTree<CartState, RootState> = {
if (err) {
console.error(err)
}
if ((Date.now() - lastCartBypassTs) >= (1000 * 60 * 24)) { // don't refresh the shopping cart id up to 24h after last order
if (!rootStore.state.config.cart.bypassCartLoaderForAuthorizedUsers || (Date.now() - lastCartBypassTs) >= (1000 * 60 * 24)) { // don't refresh the shopping cart id up to 24h after last order
rootStore.dispatch('cart/serverCreate', { guestCart: false }, { root: true })
}
})
Expand Down
1 change: 1 addition & 0 deletions core/store/modules/checkout/actions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ const actions: ActionTree<CheckoutState, RootState> = {
placeOrder (context, { order }) {
try {
context.dispatch('order/placeOrder', order, {root: true}).then(result => {
Vue.prototype.$db.usersCollection.setItem('last-cart-bypass-ts', new Date().getTime())
context.dispatch('cart/clear', {}, {root: true})
if (context.state.personalDetails.createAccount) {
context.commit(types.CHECKOUT_DROP_PASSWORD)
Expand Down