A
A
Analka2021-02-24 14:58:43
Vue.js
Analka, 2021-02-24 14:58:43

How to remove item from cart in vue js after 10 minutes?

The project on vue

has the task of adding a product to the cart, over time, after which the product is removed from the cart, the

product is added to the cart in the store

state.cart.push({
      id: product.id,
      name: product.name,
      path: product.path,
      image: product.image,
      price: product.price,
      old_price: product.old_price,
      created_at: new Date().getTime(), //текущая дата
      expiration_at: new Date().getTime() + 10000 текущая дата + 10 мин,
      quantity: 1
    })

how to implement automatic removal of goods from the cart if 10 minutes have passed and the order has not been placed

Answer the question

In order to leave comments, you need to log in

1 answer(s)
E
Eugene, 2021-02-24
@Nc_Soft

No need to delete anything, you just need to not show in the trash what is older than 10 minutes

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question