Documentation
Feedback
Guides
API Reference

Guides
Guides
VTEX Sales App

Setting up Sales App extensions

Learn how to set up extensions for Sales App in your store.

This feature is in beta, and we're working to improve it. If you have any questions, please contact our Support.

VTEX Sales App Extensibility lets you customize the default assisted-sales journey with features that support your business requirements.

By using predefined extension points, you can integrate external APIs, use VTEX data, and add custom experiences to areas such as cart and checkout, the side menu, and the product details page.

In this guide, you'll learn how to set up Sales App extensions for your stores.

Before you begin

  • Set up your FastStore monorepo. The monorepo uses a faststore.json file at the repository root to define module settings such as paths and ports for local development and production.

  • Install the VTEX Sales App on your account, complete the onboarding in VTEX Admin, and add a sales associate linked to a store. For detailed instructions, see the guide VTEX Sales App - Basic settings.

Instructions

Step 1 - Installing the Sales App package

Add the Sales App modules to your monorepo:


_10
yarn add @vtex/sales-app -D -W


_10
npm add @vtex/sales-app -D

Step 2 - Creating a Sales App project

Ensure the following information is available:

  • The store account name for which you're creating extensions.
  • The module you want to initialize a project. In this case, it's sales-app.
  • The path where you want to initialize the project.

Run the following commands in your terminal:


_10
yarn fsp create


_10
npx fsp create

As an example, consider the account store-a and the path ./store-a/sales-app. Remember to fill in the prompts according to your project requirements:


_10
> ? What's the account name? store-a
_10
> ? Which module do you want to initialize? sales-app
_10
> ? What should be the path to initialize sales-app? ./store-a/sales-app

After running the command, the folder is created at the root of your monorepo based on the path you provided. Your monorepo structure should look similar to this:


_11
📂 account-monorepo
_11
_11
├──📂 store-a
_11
│ └──📂 sales-app
_11
│ └──📂 src
_11
│ └── 📂 components
_11
│ │ └──📄 Example.tsx
_11
│ ├──📄 Example.css
_11
│ ├──📄 index.tsx
_11
│ └──📄 package.json
_11
└──📄faststore.json

Project structure

The src/index.tsx file at the root of your project is the entry point for all VTEX Sales App extensions you create. It looks like this:

src/index.tsx

_10
import { defineExtensions } from '@vtex/sales-app'
_10
import { Example } from './components/Example'
_10
_10
export default defineExtensions({
_10
'cart.cart-list.after': Example,
_10
})

The defineExtensions function connects the extensions you create to the extension point where they should appear. You can create your extensions in separate files and then import them into index.tsx to keep your project organized.

This function also helps during development by showing available extension points with autocomplete and type-checking, making the setup easier and less error-prone. To build your extension, use the hooks, types, and helper functions available in the @vtex/sales-app package. For more information, see the Sales App extension hooks and types guide.

The src/components/Example.tsx file includes a sample extension point. You can import CSS files, such as Example.css, to define classes and make them available globally. Organize your code however best fits your project, either by separating implementation and styling into different files or by keeping everything in a single file. For additional information about CSS, refer to CSS styling in VTEX Sales App Extensibility

The faststore.json file should include a sales-app entry like the following:


_10
{
_10
"store-a": {
_10
"sales-app": {
_10
"path": "./store-a/sales-app",
_10
"port": 3002
_10
}
_10
}
_10
}

The fsp create command updates faststore.json automatically. Review the generated values to make sure the account name, path, and port match your project.

Step 3 - Configuring the project as a workspace

Register the new project as a workspace in the root package.json file so the package manager can discover it and install dependencies correctly.

For example, if you're using Yarn, your package.json should include:


_10
{
_10
"workspaces": [
_10
"store-a/sales-app"
_10
]
_10
}

For more information, see your package manager's documentation on workspaces, such as the Yarn or npm documentation.

After a workspace is declared, run the install command at the root of the monorepo:


_10
yarn install


_10
npm install

Step 4 - Previewing extensions in development

After installing the dependencies, start your storefront development environment with the CLI:


_10
yarn fsp dev store-a


_10
npx fsp dev store-a

The VTEX Sales App is available at the /sales-app/checkout/cart path on the URL provided by the FastStore CLI. You should see a screen similar to this:

{"base64":"  ","img":{"width":3600,"height":1882,"type":"webp","mime":"image/webp","wUnits":"px","hUnits":"px","length":40382,"url":"https://cdn.jsdelivr.net/gh/vtexdocs/dev-portal-content@main/images/sales-app-extensions-1.webp"}}

You can also access the VTEX Sales App locally using the path and port values defined in faststore.json. For example, if the file specifies port 3002, open http://localhost:3002/sales-app/checkout/cart.

Contributors
1
Photo of the contributor
Was this helpful?
Yes
No
Suggest Edits (GitHub)
See also
Exploring Sales App extensions
Guides
Creating Sales App extensions
Guides
Contributors
1
Photo of the contributor
Was this helpful?
Suggest edits (GitHub)
On this page