Grow your business

Use VTEX Session to provide a customized browsing experience

Thomas Low-Beer
Thomas Low-Beer
Created at
3/27/2019

The installation of VTEX Session allows, among other functionalities, your store to perform a regionalization of the user experience by appointing one or more sellers to a specific region (regionId).

Within the omnichannel paradigm, in which your store is considered an inventory and can receive orders for either dispatch or withdrawal, it's important to consider that a user's ecommerce browsing is dependent on the origin of the inventory, in such a way that a product shelf can be set up according to the delivery probability for this particular user.

Nobody likes to choose a product only to discover that it can't be shipped to the chosen address. For this reason, when applying the concept of region to set up a product shelf, we are effectively asking sellers if they serve a specific geolocation.

By definition, the main seller (ecommerce) is always considered as part of all regions, since we understand that its Distribution Centre serves any region. However, configuring user browsing on your store is possible, in order for the main seller's inventory not to be displayed on the product shelf, using the sales policy feature.

This implies that, upon accessing your store, the user will only see products displayed that were made available by the configured sales policy. As such, since the main seller will not have any inventory configured for this policy, the user will only see the desired availalble sellers during the purchase process.

Use case

Suppose a retailer wishes that only one seller (which is not the main one) be considered for a specific region. The retailer can give its customers the option to select a specific store during browsing. By doing so, a family going to the mall could, for example, browse for available products in that store beforehand.

As mentioned above, such a scenario implies giving the user the possibility of choosing a desired store (seller) when accessing the site. As such, upon choosing a store, the customized sales policy for that store would also load.

In practice, other browsing customizations for the same user may coexist, such as a specific UI through the multistore feature ("store.retailer.com.br").

Upon choosing the store, the front-end should load the site by going through a querystring parameter such as ?regionId={{value}}, where the value should be encoded in base64 and follow the SW#Mainseller;Chosenseller default.

business-guide-vtex-session

  • regionId: U1cjbG9qYWFuaW1hbGU7YW5pbWFsZW9zY2FyZnJlaXJl

  • regionId: SW# seller1; sellerX; sellerY;....; sellerZ

This querystring will be recognized by the VTEX Session app, which is responsible for handling the information from a specific session belonging to user browsing your store, through the vtex_session cookie.

Of the functions Session has, upon creating the Region functionality, is to inform the Portal of the product display conditions. The Portal would then only display products available in that predefined region.

The simulation performed by Portal to Checkout is similar to the one below:

  • Method: POST

  • URL:

http://lojaprincipal.vtexcommercestable.com.br/api/checkout/pub/orderForms/simulation?rnbBehavior=0&sc=2

Ex:

{

  "items": [

      {

          "id": "61628",

          "quantity": 1,

          "seller": "1"

      }

  ],

  "country": "BRA",

   "postalCode": "22291070",

  "geoCoordinates": [],

  "shippingData": {

      "logisticsInfo": [

          {

              "itemIndex": 0,

              "regionId": "U1cjbG9qYWFuaW1hbGU7YW5pbWFsZW9zY2FyZnJlaXJl"

          }

      ]

  }

}

In the example above, the SKU 61628 in only in stock with the seller. In the main store, there is no available inventory for the product sc=2.

Still got questions?
Ask the community
Find solutions and share ideas in VTEX's community.
Talk to our experts
Get in touch if you have something specific to ask about the platform.
  • PT
  • ES
VTEX website