Documentation
Feedback
Guides
API Reference

Guides
Guides
VTEX Sales App

Creating Sales App extensions

Learn how to create a Sales App extension and render it in a predefined extension point.

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

After setting up a Sales App extension project in your FastStore monorepo, you're ready to create custom experiences by rendering React components in predefined extension points.

To create a Sales App extension, it's not mandatory to configure the discovery module. In this setup, FastStore provides the monorepo structure, tooling, and build process, while the sales-app module contains the extension code.

In this guide, you'll learn how to create a basic extension and connect it to an extension point.

Before you begin

Instructions

Suppose you want to create a custom message for your Sales App. Based on the sample folder generated in your monorepo when creating the project, follow the steps below.

Step 1 - Creating the component

To create a new component, add the following content to your TypeScript JSX file (for example, src/components/CustomMessage.tsx):

src/components/CustomMessage.tsx

_10
export const CustomMessage = () => {
_10
return (
_10
<p>
_10
Extension example
_10
</p>
_10
)
_10
}

This component renders a simple custom message in the VTEX Sales App interface.

Step 2 - Registering the extension

Import the new component into src/index.tsx. Then, connect it to an extension point.

src/index.tsx

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

In this example, the component is rendered in the cart.cart-list.after extension point. Learn more about the available extension points in the Exploring Sales App extensions guide.

After saving the file, open the cart page again. The custom message should appear below the cart item list.

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

Once you have created an extension and connected it to an extension point, you can customize your component's styling. For detailed instructions, see the guide CSS styling in VTEX Sales App Extensibility.

Contributors
1
Photo of the contributor
Was this helpful?
Yes
No
Suggest Edits (GitHub)
Contributors
1
Photo of the contributor
Was this helpful?
Suggest edits (GitHub)
On this page