Adding a guest role to an existing user, prevents checkout

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.
13 Jahre weitere
I discovered something that may be or may not be a bug.  If a registered or admin user is also in the guest role, the system assumes they are a guest and prevents them from checking out.  This is odd, since under the same case your allowed to log in without any issues.

The following code in ShoppingCartController.StartCheckout:

            if (_workContext.CurrentCustomer.IsGuest())    // Can't proceed if the user is also an admin or registered user
            {
                if (_orderSettings.AnonymousCheckoutAllowed)
                {
                    return RedirectToRoute("LoginCheckoutAsGuest");
                }
                else
                {
                    return RedirectToRoute("Login");
                }
            }
            else
            {
                return RedirectToRoute("Checkout");
            }

This piece of code should take into consideration that the admin UI allows you to check off guest, registered and or admin roles for the same user.  If you encounter this problem, ensure that the user hasn't been added to the guest role inadvertently.
13 Jahre weitere
Actually it's not possible. A customer cannot be in both 'guest' and 'registered' roles (of course, if you did not add him to them manually in admin area. why?).
13 Jahre weitere
In the admin area, it's possible to add multiple roles for a user.  Although a administrator or a registered user shouldn't also be guests, the administration system should prevent this.  I agree that there's little reason to add guest roles to the administrator, but it is perfectly conceivable why someone would check off all the boxes to ensure that their user covers all the possible roles.  

Generally, the user interface should prevent users from doing things that have unintended consequences such as not being able to checkout.  You may want to consider a mutual exclusion option, where if the guest check box is checked, the others are unchecked.  This can be easily done with knockout.js.
This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.