How Ecto decides which cart to keep
Ecto is designed to keep cart synchronization simple, invisible, and predictable.
To do that, it follows a clear rule:
👉 Ecto always keeps the most recently edited cart for a logged-in customer.
At any time, only one cart per customer is stored.
When a cart is saved
Ecto saves carts only for logged-in customers.
Once a customer is logged in, Ecto listens to cart actions such as:
- adding a product
- updating quantities
- removing items
Each of these actions updates the cart’s last modification time, which Ecto uses to determine which cart is the most recent.
What happens before login
If a customer creates or edits a cart before logging in:
- the cart exists only on the customer’s device
- no cart data is sent to Ecto yet
- Ecto cannot associate the cart with a customer
This cart is not immediately considered the active cart.
What happens at login
When the customer logs in, Ecto compares the two cart versions:
- the cart currently on the customer’s device
- the cart already saved in Ecto
If the cart saved in Ecto is more recent, it is restored on the customer’s device.
Otherwise, the cart on the customer’s device becomes the new saved reference.
This comparison ensures that the most relevant cart is always kept.
Cross-device example
- A customer builds a cart on desktop at 10:00 while logged in
→ Cart A is saved in Ecto
- On mobile, the customer adds items at 10:10 before logging in
→ Ecto is not aware of this cart yet
- The customer logs in on mobile at 10:15
→ Ecto compares both carts
→ The mobile cart is more recent and replaces Cart A
- If Cart A had been more recent
→ It would have been restored on the mobile device instead
This behavior is expected and intentional.
Why Ecto works this way
This logic avoids:
- outdated carts overwriting newer ones
- conflicts between devices
- popups asking customers to choose a cart
Ecto always prioritizes the most recent cart activity.
Key takeaway
- Ecto saves carts only for logged-in customers
- Ecto keeps one cart per customer
- Cart synchronization is based on last modification time
- The most recently edited cart always wins
Updated on: 24/08/2026
Thank you!
