# Build a checkout extension

> Build a Shoplazza checkout extension end to end with Shoplazza CLI: scaffold, develop with live reload, build, push a version, activate it, then preview.

This tutorial builds a checkout extension end to end — scaffold, develop, push a version, then activate it. `checkout` is an alias for `checkout-extension`.

## Prerequisites

* Shoplazza CLI installed — see [Install](../install)
* Authenticated — see [Authentication](../authentication)

## 1. Scaffold the project

`init` creates a project directory with a first extension (local, no network):

```shell
shoplazza checkout init --name my-project --extension my-ext
cd my-project
```

To add more extensions later, run `shoplazza checkout create --name another-ext` inside the project.

## 2. Develop with live reload

Start the dev server (rebuild + HMR on port 8888):

```shell
shoplazza checkout dev --extension-name my-ext
```

Develop several at once with `--extension-name ext1,ext2`, or all of them with `--all`.

## 3. Build

```shell
shoplazza checkout build --name my-ext
```

## 4. Push a version

`push` builds and uploads a new version but does **not** activate it:

```shell
shoplazza checkout push --name my-ext
```

Optionally set the version explicitly (it must be greater than the last pushed version):

```shell
shoplazza checkout push --name my-ext --version 1.1
```

## 5. Activate it

Find the server-side extension id and its versions:

```shell
shoplazza checkout list --all
shoplazza checkout versions --extension-id abc123
```

Then activate the version with `deploy`:

```shell
shoplazza checkout deploy --extension-id abc123 --version 1.1
```

:::tip
Add `--dry-run` to `deploy`, `undeploy`, `preview`, and `versions` to print the request without sending it.
:::

## 6. Preview

Generate a shareable preview URL for a version:

```shell
shoplazza checkout preview --extension-id abc123 --version 1.1
```

## Next steps

* [checkout-extension command reference](../commands/checkout-extension)
* [Build and publish a theme](./build-and-publish-a-theme)
