How handle guest checkout when purchasing membership product?

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.
7 years ago
Selling a product that will add the user to a new user role, allowing them to view a role restricted topic page.

How do you handle the case where the user checks out as guest? There would be no way for this to work and the user to get access to that topic correct? So is it possible to not allow check out as guest if any products in cart result in adding user to new role? Or another way to skin this cat?
7 years ago
Anyone?
7 years ago
chadwixk wrote:
How do you handle the case where the user checks out as guest? There would be no way for this to work and the user to get access to that topic correct? So is it possible to not allow check out as guest if any products in cart result in adding user to new role? Or another way to skin this cat?

I don't think it's currently possible by default so you'd probably need to customise the ShoppingCartController. There's a setting called RequireRegistrationForDownloadableProducts which only enforces similar behaviour for downloadable products. You can see how it's implemented in the ShoppingCartController:

            //everything is OK
            if (_workContext.CurrentCustomer.IsGuest())
            {
                bool downloadableProductsRequireRegistration =
                    _customerSettings.RequireRegistrationForDownloadableProducts && cart.Any(sci => sci.Product.IsDownload);

                if (!_orderSettings.AnonymousCheckoutAllowed
                    || downloadableProductsRequireRegistration)
                    return new HttpUnauthorizedResult();
                
                return RedirectToRoute("LoginCheckoutAsGuest", new {returnUrl = Url.RouteUrl("ShoppingCart")});
            }

It might even be worth marking your membership product as downloadable and see if it does what you want, though there may be other undesirable side effects of that.

It would also be worth posting it in the suggestions forum if you think it's something that should be available by default in a future version of nop.
7 years ago
You might consider utilizing a plugin which automatically converts all your guests to registered customers. This way you can still have guest checkout enabled, but every customer becomes registered automatically. The plugin generates and emails the new customer their password after order completion.
7 years ago
Thanks Pete. I'll try out your suggestions.
7 years ago
That's not a bad idea embryo.  Thanks.

embryo wrote:
You might consider utilizing a plugin which automatically converts all your guests to registered customers. This way you can still have guest checkout enabled, but every customer becomes registered automatically. The plugin generates and emails the new customer their password after order completion.
This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.