I have WordPress version 4.9.5 with our own theme, and WooCommerce as online shop solution.
Imagine that some user logs in to the website and adds some items in shop cart. Then he exits from website, whether he closes web page or logs out. After some time (doesn't matter is he on the same computer or not), when same user visit website (as a guest, without login) and adds some items in shoping cart and goes to checkout, WordPress merges two carts (items from the past and currently added in cart). I need to remove old items and keep only new items.
Example: (cart contents when user is logged in)
- Item 1
- Item 2
(cart contents when user is guest/logged out)
- Item 3
- Item 4
(cart contents after logging in during checkout)
- Item 1
- Item 2
- Item 3
- Item 4
I need cart to keep only:
- Item 3
- Item 4
How should I do that?