Magento 2 B2B Registration & Login Combo is a complete solution to restrict access to non-logged-in customers and encourage them to create a B2B registration, with which the admin can review and approve/disapprove the account.
2. How Does It Work?
2.1. Force Login
Please go to Store ⇒ Configuration ⇒ BSSCommerce ⇒ Force Login
2.1.1. General configs
In Enable: choose Yes to enable the Force Login functions.
In Disable Registration: choose Yes to disable the Registration link on the top link and login page, or No to enable it for the customer to sign up.
2.1.2 Enable “Force Login” When users visit pages
In Alert Message: edit a force login message to be shown on the restricted page.
Select types of page to force login to access:
|Product PageCategory PageCart PageCheckout PageSearch Term Page||Advanced Search PageSearch Results PageContact PageOther PagesCMS Pages|
- Other Pages are custom pages created by third-party extensions, for example, the FAQs
2.1.3 Redirect users after successful login
It is important to streamline the experience of users after “force-login” requirement. You can choose among 4 redirect options.
- Default: redirect users to the page after login like default Magento 2
- Home Page: redirect users to Home Page after login
- Previous Url: redirect users to the page they are trying to access when they are forced to login
- Custom Url: Enter the page URL that you want to send your customers to after login
- With custom pages by third-party extensions, if you select this option, you will be redirected to the previous page of the force login page.
For example: You require a login to access the FAQs page.
A customer goes to the Home page ⇒ Women (category page) ⇒ FAQs page and login. He/She is redirected to Women (category page).
- Remember to Save Config on completing
2.1.4 Google reCAPTCHA & 2FA installation
Magento is adding Google reCAPTCHA and 2FA functionality to all Magento Commerce and Open Source versions 2.1 and above to reduce unauthorized access and spam.
- Google reCAPTCHA technology is to ensure the access attempt by humans only, not bots. Compared with Magento CAPTCHA module, the reCAPTCHA enhances security with additional benefits includes support for invisible reCAPTCHA.
- 2FA Authentication adds support for software authentication apps and hardware authentication devices provided by Google Authenticator, Authy, U2F devices, and Duo Security, among others.
Hence, BSS Commerce strongly recommends installing these functions for your Magento 2 Website.
Please go to the Magento 2 Dev Document for more information.
2.2. B2B Registration
2.2.1. In the frontend
The admin can include a B2B Registration form besides the default form. This form has additional fields to get to know more about B2B customers.
More importantly, the admin can review and approve or reject the B2B registration instead of activating the account automatically like the default.
- When the users complete the B2B registration form, a pending message is shown.
An email will be sent to the admin’s email to inform of the new B2B registration. Then, admin can manage over that account.
- If the admin approves the registration, an email will be sent to the user’s email.
- If the admin rejects the registration, a disapproval email is sent respectively. And, an error message is shown when the users try to access the account in the frontend.
2.2.2. In the backend
Go through Stores ⇒ Settings ⇒ Configuration ⇒ BSS Commerce ⇒ B2B Registration.
- In Enabled: choose Yes to enable the module.
- In B2B Account Page URL: enter URL of the customer registration page
- In Shortcut Link in Header: select Yes to enable the shortcut link in the header. So customers can click this shortcut link to navigate the registration page.
- In Shortcut Link Text: enter the title of the shortcut link in the header.
- In Form Title: enter the title of the B2B registration form
Choose additional fields in the B2B Registration form. If you do not want any fields to show up, choose No.
Please ensure that by default, these fields are not required. Go to Configuration ⇒ Customer Configuration ⇒ Name and Address Options to check.
- In Default Customer Group: choose a group which you want to add the customer into.
- In Disable Regular Registration: select Yes to disable the normal “Create an Account” link in the header, “Create an Account” button in Sign-in Page and checkout page.
Choose No to enable both “B2B Registration link” and the default “Create an Account link.”
- In Auto Approve Accounts: Choose Yes if you want to accept new B2B accounts automatically or No if you want to approve accounts manually
NOTE: Even when you approve the B2B registration requests automatically, you can still change their status in the backend.
- In Pending Message: enter Pending message.
- In Disapproval Message: enter Disapproval message.
Admin email settings
- In Enabled: choose Yes to enable configurations below.
- In Email Sender: enter the name of the sender from Store Email Address of the default.
- In Email Templates: choose among available email templates of websites to notify the admin of new B2B account
- In Recipients: enter emails, separated by commas, to receive notification about new accounts created.
Customer email settings
- In Enabled: choose Yes to send notification emails to customer
- In Email Sender: enter the name of the sender from Store Email Address of the default.
- In Approval Email Templates: select among available email templates of your site to send an email after the admin approves the B2B registration
- In Disapproval Email Templates: select among available email templates of your site to send an email after the admin rejects the B2B registration
DEFAULT CAPTCHA SUPPORT
To enable Captcha in the B2B Registration form, please follow Stores ⇒ Configurations ⇒ CUSTOMERS ⇒ Customer Configuration ⇒ CAPTCHA
- Set Enable CAPTCHA on Storefront to Yes.
- In Form, choose Create User form to enable the CAPTCHA
- Set Display Mode to either Always to After number of attemps to login.
- Define CAPTCHA settings.
MANAGE B2B REGISTRATION REQUESTS
In Customer Grid:
There is an additional Status column in Customer Grid in the backend so that the admin can check the status of B2B accounts and make adjustments accordingly.
The admin can edit the status of single B2B account by double-clicking in any position in the row:
or, multiple B2B accounts:
or in Account Information of specific account:
If the admin creates an account in the backend for a customer, there will be an approval notification email sent to the customer after finish creating this account.
However, that account has Normal status, admin can change into B2B Approval status, there also a notification email sent to that customer.
2.3. Customer Attributes
2.3.1 General config
Go to Stores ⇒ Configuration ⇒ BSSCommerce ⇒ Customer Attributes.
In Enable, choose Yes to enable the extension or No to disable it.
*Note: The Enable config only affects frontend display. Other backend functions aren’t affected by this config.
In Allow Dowload Customer Attribute File: choose Yes to allow downloading the file uploaded to customer attribute or No to restrict downloads.
In Title of Customer Attributes, enter the name for the customer attributes block. This title will be displayed in Registration Form and My Account Page.
In Set Default Required Attributes for Existing Customer, choose Yes if you want required attributes to be applied for existing customers. Otherwise, choose No.
2.3.2 Create new attributes
Go to Customers ⇒ BSSCommerce ⇒ Customer Attributes.
Customer Attributes Grid which displays all customer attributes created by admin. The Customer Attributes Grid is equipped with all function like a default Magento 2 grid, including filter, column, mass action (delete, update status).
Click Add New Attribute button to create a new customer attribute. Then, you will see 3 tabs: Properties, Manage Labels, and Display Configuration.
Later, you can also remove Magento 2 customer attributes, as wished.
In Default Label, enter a name for the customer attribute.
In Input Type, choose 1 of the 9 input types: Text Field, Text Area, Date, Yes/No, Multiple Select, Dropdown, Checkbox and Radio Button, File (Attachment).
- If you choose Multiple Select, Dropdown, Checkbox or Radio Button, add options for the customer attribute in Manage Options.
In Values Required, choose Yes to make the customer attribute compulsory to fill in; otherwise, choose No.
Advanced Attribute Properties:
In Attribute Code, enter a code for the customer attribute. No space allowed and no more than 30 symbols.
*Note: In case none value is entered for Attribute Code, the extension will automatically get the value of Default Label as value for this field.
In Maximum File Size (bytes), enter a number to define the largest file size possibly uploaded.
In File Extensions, type allowed file extension that can be uploaded to the customer attribute. Each is separated by a comma.
In Default Value Required for Existing Customer, enter a value if the attribute is set as Required. This field will be only shown when the Values Required is Yes and the Input Type is text field, area, datetime, or file.
In Input Validation for Customer, set a type of data allowed in the field. The available values depend on the Input Type specified.
None—The field has no input validation during data entry.
Decimal number—Accepts only decimal number during data entry.
Integer Number—Accepts only integer number during data entry
URL—Accepts only a URL during data entry
Letters—Accepts only letters during data entry
Letters (a-z, A-Z) or Numbers (0-9)—Accepts any combination of numbers (0-9) and alphabetic characters (a-z, A-Z) during data entry.
Customer Attributes for Magento 2 extension supports multiple store view, so you can display different customer attribute labels per store view.
In Sort Order, set the order of appearance for the customer attribute in the Registration form.
*Note: The sort order set here will also decide the order of appearance of the attributes in the backend.
In Status, enable or disable the customer attribute.
In Display in Registration Form, choose Yes to add the customer attribute to Registration Form.
In Display in My Account Page, choose Yes to add the customer attribute to My Account Page.
In Display in Order Detail Page, choose Yes to add the customer attribute to Order Detail Page under Sales of Admin Panel.
In Display in Customer Grid, choose Yes to add the customer attribute to Customer Grid.
In Add to Order Confirmation Email, choose Yes to display the customer attribute in the Order Confirmation email.
In Add to New Account Email, choose Yes to display the customer attributes in New Account email.
In Add to Order Frontend, choose Yes to display the customer attributes on Order Detail Page under My Account.
*Note: You need to reindex data of Customer Grid whenever you make any change in Display in Customer Grid config.
In Display on Checkout Page, choose Yes to show added customer attributes in the checkout page – under the shipping address or the payment method (with the virtual cart.) All filled information is saved upon order placement.
*Note: Attributes of all input types, except for “File”, are supported at the checkout page.
In Hide If Filled Before, choose Yes to hide the customer attributes at the checkout page if they are filled before.
In Show Attribute in, choose where to show the attribute in the registration form, among Customer Attribute Section, Sign-in Information Section, and Personal Information.
2.3.3 Create a new email template
As above, customer attributes are possibly set to display on Order Confirmation email and New Account email.
First off, you need to create a new template which includes customer attributes variable. Please follow Marketing Email Templates Add New Template.
- New Order Confirmation email template
In Template section of Load default template, you can select among various default email templates, for example, New Order. Then, hit on Load template button.
Under Template Information, select Insert Variable… to add customer attributes to new order confirmation template.
Do not forget to enter Template Name and Save the new template.
Secondly, set this new template as the Order Confirmation email by going to Stores Configuration Sales Sales Emails Order.
In New Order Confirmation Template, uncheck Use system value box and choose the newly created email template.
On completing, please Save Config.
- New Account email template
Similarly, you can create a new template with customer attributes for New Account email.
In Template of Load default template section, choose New Account (Default) template and hit Load Template.
Under Template Information, enter Template Name and select Insert Variable… to add customer attributes to New Account template.
Then, Save Template.
To set this new template as the New Account template, please follow Stores Configuration Customers Customer Configuration and expand Create New Account Options.
In Default Welcome Email, unmark Use system value box. Then choose the newly created template. Save Config to complete the settings.
2.3.4 Display Customer Attributes
Display customer attributes in Registration Page:
*Note: Customer Attributes for Magento 2 extension only supports checkbox in the frontend while in the backend, the checkbox is displayed in multiple-selection type.
A New Account email will be sent to the register, which includes the customer attributes based on the admin’s configuration.
Display Customer Attribute in Account Information of My Account Page:
At Checkout page:
Customer attributes can also be displayed on Order Confirmation email:
And on Order Detail Page under My Account.
Go to Customers ⇒ All Customers.
Display customer attribute in Customer Grid:
Display customer attribute in Customer Detail Page:
Go to Sales Orders.
Display customer attribute in Order Detail Page:
2.3.5. Import Customer with Attributes
Customer Attributes for Magento 2 extension allows importing customer with the created customer attributes by using the .csv file.
Firstly, prepare the file of customer information with customer attributes to import. All created customer attributes must be included in the import file with each customer attributes code listed in separate columns. Please make sure that all customer attribute codes are the same as attribute codes of existing customer attributes.
For customer attributes with the input type is a checkbox or radio button, use option’s ID instead of options’ value. For customer attributes with the input type is a dropdown or multiple select, fill in with correct options’ value.
Admins can also download the sample file by following System Import.
In Entity Type, choose Custom Main File to import new customers with customer attributes.
In Import Behavior, select one of the following actions:
- Add/Update complex data: New data is added to the existing attributes in the database.
- Delete Entities: Any existing data of entities in the import file is removed from the database of the stores.
- Custom Action: Admins can also override the import behavior by writing a custom option.
In Select file to Import, upload the file prepared earlier. Make sure that the size of the uploaded file is not more than 3M.
On completing, tap Check Data button in the upper-right corner. Wait for few seconds for the validation to perform.
If the import data is valid, the successful message will be displayed as in the screenshot. Click on Import button to process the import to the end of the data. Otherwise, there is any problem in data, the error message will appear. Just correct the invalid data and re-upload the file.