VTEX Developer Portal

Configuring a B2B environment

B2B (Business to Business) is an abbreviation used in e-commerce in reference to commercial transactions between companies.

In other words, B2B stores only sell their products to other stores. Because of that, their environments require user authentication, since these are usually blocked, completely or partially, for anonymous users.

It is quick and easy to provide a B2B environment for your IO store. Follow the step by step below and learn how to make your store's content available only to users of other customer stores.

Step by step

Step 1 - Configuring the Challenge block

The key element that ensures the security of the displayed content is the Challenge Trade Policy block, responsible for checking if the store's user is allowed to browse the B2B environment.

Check out the Challenge Trade Policy documentation to configure it correctly in your store and proceed to the next steps.

Step 2 - Defining the Condition Rule

With the Challenge configured, it's time for you to define what the access criterion will be - in other words, the condition rule that will allow a user to browse your store.

To define the condition rule, you first need to choose which of your store's Trade Policy it will be applied to. Each Trade Policy must have its Condition Rule defined individually, since each one has its own catalog, price and logistics particularities.

Make sure you fully understand what the Trade Policies for VTEX stores are before performing the steps below:

  1. Access the Trade policies section in the admin's sidebar;
  2. Choose the desired Trade Policy. You can edit an existing one, by clicking on Edit, or create one from scratch, by clicking on New Trade Policy.
  3. In the Condition Rule field, define an access criterion of your choosing for the users who will access the trade policy in question. For example: if only logged in users can access store content, your Condition Rule could be something like approved=true.

condition-rulecondition-rule

️ The value entered in the Condition Rule field can be any one of your choosing. Remember to choose an intuitive condition and a clear rule, since both will be added to Master Data later for the user's verification to be successful.

Step 3 - Updating the user form in Master Data

In this last step, you will create a link between the Condition Rule and the user profiles you want to have access to the store.

In other words, you will add a field in the profile forms of the users in question (through the admin's Master Data). That field is able to indicate whether the user is qualified to browse your store, according to the criterion you set forth.

  1. Access Master Data from the admin's sidebar;
  2. In the Profile System box, click on the settings icon;
  3. Select the option Data structure inside the Configurations box;
  4. Once in the new window, access the Data Entities tab;
  5. In the customer's Data Entity, create a user field. According to the previous example, we could create a Boolean type approved field, with two possible options: true (logged in) and false (not logged in)
  6. Add the newly created field to the forms of the target user in order to verify and grant access to these customers.

There you go! After completing all the steps, your store is ready and safe to focus your sales to other companies!

Updated 13 days ago


Configuring a B2B environment


Suggested Edits are limited on API Reference Pages

You can only suggest edits to Markdown body content, but not to the API spec.