Prevent unauthenticated users from being attached to existing customer accounts via email in the cart #4135
              
                Unanswered
              
          
                  
                    
                      dezeweetjeniet
                    
                  
                
                  asked this question in
                Ideas
              
            Replies: 0 comments
  
    Sign up for free
    to join this conversation on GitHub.
    Already have an account?
    Sign in to comment
  
        
    
Uh oh!
There was an error while loading. Please reload this page.
-
Description:
Currently, when an unauthenticated user enters an email address in the cart that belongs to an existing customer, the system automatically attaches the order to that existing customer. This can lead to privacy issues and confusion, as the current user is not logged in and may not be the owner of the email.
Additionally, if the existing user belongs to a user group with specific pricing rules (e.g., discounts), the “guest” customer receives those benefits, and the orders are recorded in the existing user's order history. This can cause:
Expected behavior:
If an unauthenticated user enters an email that belongs to an existing customer, the system should not automatically attach the order.
Options include:
Steps to reproduce:
Suggested solution:
The problem occurs in CartController )when an unauthenticated user enters an email address.
The code uses ensureUserByEmail($email) and automatically attaches the order to that existing customer.
https://github.com/craftcms/commerce/blob/a38a5b5ae5e65f56eeb5e6c345fc47508ad4a716/src/controllers/CartController.php#L270C8-L287C10
Beta Was this translation helpful? Give feedback.
All reactions