Remember Me
Log in

How to Limit Access to Wholesale Store View in Magento 2

Magento 2 Extensions
Written by ITORIS Team, 2017-09-21   

How to Limit Access to the Wholesale Store View in Magento 2

Being a wholesaler means to purchase products usually through discounts based on volume buying. Retail customers can’t get some wholesale privileges such as discounts or availability of certain products. Imagine that your Magento 2 store is required to limit access to a particular store view, for example, Wholesale. The Store Login Access extension is an effective tool allowing to restrict regular customers from buying at this particular store.

Do you want to hide the whole store leaving the registration form available only? Want to store customers’ emails to expand the newsletter database next month? Or need to improve the registration process for wholesalers by collecting necessary information? The Store Login Access extension for Magento 2 helps to manage your store access permission by getting control over the login and registration forms. The Registration Fields Manager plugin for Magento 2 also improves customer profiles by adding more custom fields to the registration form.

The extension allows to hide your store or store view with all products behind the login or registration form. See below.


How to Hide a Store Behind the Login Form in Magento 2


Store Access Configuration

Let’s configure the main settings and limit access to the “Wholesale” store view. Go to STORES -> Settings -> Store Login Access and find the “Store Login Access” section.


How to Manage Store Access in Backend in Magento 2


As we need to limit access to “Wholesale” through the login form, mark the last checkbox “Wholesale” in column “User should login to access Frontend”. In this case retailers have to create a wholesale account, otherwise the access to this particular store view will be denied. Wholesalers will get access to all store views and even purchase like retailers.

The second column hides the “Create an Account” link on Frontend disabling the registration completely. To disable the registration form, clear checkbox next to the necessary stores.

If you enable the Registration Fields Manager extension, the last column will be available for configuration. You can create a custom registration form using the module and apply it to each store. You can mark checkbox and the custom form will be available for particular customers in the store view. This functionality helps to collect necessary data about wholesalers and limit access to retailers by requesting additional information.

Store Login Redirects

Let’s configure the redirects where wholesale customers will be redirected after successful registration or logging in. You can find several redirect options in each dropdown next to the stores. You may also choose one of the suggested redirects or enter your own direct URL, if option “Custom URL” is chosen.


How to Set Store Login Redirects in Magento 2

Your new customers can also have access to stores based on store view they register on. You can mark checkbox “Main Website::Wholesale” next to “Retail” to allow retailers to log in the “Wholesale” store view. If you leave checkbox unchecked, retailers won’t be able to use the same credentials for logging in the “Wholesale” store view.

Customer Access Control

After the main settings are configured, let’s manage access per customer manually. Go to CUSTOMERS -> Customer Access Control. You can limit access directly on the customer grid. Or we can open a customer account for editing and find tab “Store Login Access Settings”. Mark the first two checkboxes, thus the customer can login or register within these store views. After we leave the last checkbox clear, the customer won’t be able to register or login to “Wholesale”.

If you want to limit access to the “Wholesale” store view and validate new wholesale accounts manually the Pending Registration extension will allow to do that.


How to Configure Store Access per Customer in Magento 2

After access is limited, let’s try to login to the “Wholesale” store view using that customer account. As the customer doesn’t have access to this store view, the following notification will be shown: “You are trying to access the private area of the store your account is not permitted for. Please enter a valid account information.”

Forbidden Access to the Store View on Frontend in Magento 2