Menu
Feedback
Start here
Tutorials


Tutorials
Promotions
Sales associate code field at Checkout
3 min read

On VTEX, you can create a field to add the sales associate code at Checkout. It allows you to:

  • Link a particular order to a sales associate.
  • Give exclusive discounts to the customer.
  • Manage your sales associates' performance, collecting data such as the number of sales / average ticket per sales associate and sales commission ranking.

The sales associate code field does not replace the discount coupon field (native on the VTEX platform). By completing the settings outlined in this article, both can be used to give discounts.

To create the field and add it to the Checkout page of your store, you need to complete three steps:

  1. Creating a new data entity
  2. Creating a sales associate code promotion
  3. Customizing the Checkout UI

Creating a new data entity

The sales associate code field must be added to Master Data as a new entity. To create the data entity, follow the steps below:

  1. In VTEX Admin, go to Store Settings > Storefront > Master Data, or type Master Data in the search bar at the top of the page.
  2. Create a new data entity called salesassociatecode.
  3. In the new data entity, create the following fields:
    • Sales associate code: with a maximum of 10 characters (Varchar10 type).
    • Email: sales associate email address (Email type).
    • Name: sales associate name (Text type).
    • Status: indicates whether the sales associate is active or inactive (Boolean type).
    • Store: identification of the store where the sales associate works (Text type).
    • Other fields (as needed).

Creating a sales associate code promotion

After creating the salesassociatecode entity, you need to link it to a promotion. To create a new promotion, follow the steps below:

  1. In the VTEX Admin, go to Promotions > Promotions, or type Promotions in the search bar at the top of the page.
  2. Create a new regular promotion. Complete the Promotion overview and the To which items will this promotion apply? fields.

Callout Information: If you want to use the sales associate code field to give a discount on the purchase amount, complete the information in the What is the type and amount of discount?.

{"base64":"  ","img":{"width":700,"height":124,"type":"png","mime":"image/png","wUnits":"px","hUnits":"px","length":3684,"url":"https://raw.githubusercontent.com/vtexdocs/help-center-content/refs/heads/main/docs/en/tutorials/promotions-and-taxes/promotions/sales-associate-code-field-at-checkout_1.PNG"}}

Customizing the Checkout UI

The last step is configuring the Checkout interface to display the sales associate code field.

To customize this, you need to contact the partner agency that built your store and request that the new field be added, allowing the customer to enter the sales associate code and see their name displayed.

Additionally, you need to complete the following steps:

  1. When simulating a purchase and entering the sales associate code on the Checkout page, make sure that the GET Search Documents call performs the search in the entity salesassociatecode and returns all the information added for the sales associate. Example call: https://{accountName}.{environment}.com.br/api/dataentities/codigovendedor/search?codigovendedor=12345.

The status field must return true, indicating that the sales associate code is valid.

Only the sales associate name should be displayed on the Checkout page.

After completing all the above steps, the Sales associate code field will be available on the Checkout page.

{"base64":"  ","img":{"width":1566,"height":529,"type":"png","mime":"image/png","wUnits":"px","hUnits":"px","length":65609,"url":"https://raw.githubusercontent.com/vtexdocs/help-center-content/refs/heads/main/docs/en/tutorials/promotions-and-taxes/promotions/sales-associate-code-field-at-checkout_2.png"}}

Contributors
1
Photo of the contributor
+ 1 contributors
Was this helpful?
Yes
No
Suggest Edits (GitHub)
Regular promotion with reward value
« Previous
What does it mean to activate a gift multiplier on a promotion?
Next »
Contributors
1
Photo of the contributor
+ 1 contributors
On this page
Still got questions?
Ask the community
Find solutions and share ideas in the VTEX Community
Join our community
Request VTEX support
For personalized assistance, contact our experts
Open a support ticket
GitHubDeveloper PortalCommunityFeedback