When an anonymous customer has a non-empty cart and wants to log in using a registered customer that has products that no longer exists, the login fails because the merging process cannot be concluded successfully.
After this, the anonymous cart is not active and belongs to the registered customer. This means that it cannot be merged with any other customer cart, so any login or sign up functionality does not work anymore. This is the error received:
[SphereBackendException: Cart with the ID '16021f8b-bf3a-444f-9fcf-25a9199b5fb5' already belongs to the customer with the ID '08d1987b-bed6-4fef-9756-2a091498117e'.]
The way to solve it is fixing the cart when the login process fails. But this cannot be done because the current login method swallows all exceptions and errors, returning simply true or false depending on the success of the operation. In order to fix it, it is needed an exception with the list of the line item IDs that no longer exist, plus the ID of the customer cart in conflict.
When an anonymous customer has a non-empty cart and wants to log in using a registered customer that has products that no longer exists, the login fails because the merging process cannot be concluded successfully.
After this, the anonymous cart is not active and belongs to the registered customer. This means that it cannot be merged with any other customer cart, so any login or sign up functionality does not work anymore. This is the error received:
The way to solve it is fixing the cart when the login process fails. But this cannot be done because the current
login
method swallows all exceptions and errors, returning simplytrue
orfalse
depending on the success of the operation. In order to fix it, it is needed an exception with the list of the line item IDs that no longer exist, plus the ID of the customer cart in conflict.