> For the complete documentation index, see [llms.txt](https://docs.liquidcommerce.cloud/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.liquidcommerce.cloud/elements-v2/quick-start-guide.md). Agents can also search and read this documentation through its [MCP server](https://docs.liquidcommerce.cloud/~gitbook/mcp).

# Quick Start Guide

Most partners use the auto-setup approach because it is the fastest path to production. This guide covers the full data-attribute setup and all supported combinations.

## 1) Main script tag

The main SDK auto-initializes when it finds a script tag with `data-liquid-commerce-elements`.

```html
<script
  defer
  data-liquid-commerce-elements
  data-token="YOUR_API_KEY"
  data-env="production"
  type="text/javascript"
  src="https://elements.reservebar-worker.workers.dev/all/elements.js"
></script>
```

> Copy your script tag from the partner app — it already includes your partner code as the first path segment (e.g. `https://elements.reservebar-worker.workers.dev/reser/all/elements.js`), which identifies your account. The script also works without it, but including it is recommended.

### Core configuration

**Attribute:** `data-liquid-commerce-elements`\
Marks the script tag for auto-initialization.

**Attribute:** `data-token` (required)\
Your API key.

**Attribute:** `data-env` (optional)\
`staging`, or `production` (default: `production`).

**Attribute:** `data-debug-mode` (optional)\
`none`, `console`, or `panel` (default: `none`). Only honored when `data-env` is not `production`.

## 2) Product injection options

You can inject products in several different ways. All can be used together.

### A) Paired attributes on the main script tag

Use `data-product-*` with `data-container-*` pairs.

**Attribute:** `data-product-*` + `data-container-*`\
Pairs product identifiers to container IDs by matching the numeric suffix.

```html
<script
  defer
  data-liquid-commerce-elements
  data-token="YOUR_API_KEY"
  data-env="production"
  data-container-1="product-1"
  data-product-1="00619947000020"
  data-container-2="product-2"
  data-product-2="08504405135"
  type="text/javascript"
  src="https://elements.reservebar-worker.workers.dev/all/elements.js"
></script>

<div id="product-1"></div>
<div id="product-2"></div>
```

### B) Attributed product elements

Any `div` with `data-lce-product` is treated as a product container.

**Attribute:** `data-lce-product`\
Injects a product into the element and auto-generates a container ID.

```html
<div data-lce-product="00619947000020"></div>
<div data-lce-product="08504405135"></div>
```

The SDK auto-generates unique container IDs for these elements.

### C) JSON script tag

Provide an array of objects with `containerId` and `identifier`.

**Attribute:** `data-liquid-commerce-elements-products`\
Reads a JSON array of product definitions.

```html
<script data-liquid-commerce-elements-products type="application/json">
[
  { "containerId": "product-1", "identifier": "00619947000020" },
  { "containerId": "product-2", "identifier": "08504405135" }
]
</script>
```

## 3) Cart options (auto-UI + custom UI)

Cart buttons are configured from the main script tag.

### Basic cart button

**Attribute:** `data-cart-button`\
Renders a cart button in the specified container (by ID or selector).

```html
<script
  defer
  data-liquid-commerce-elements
  data-token="YOUR_API_KEY"
  data-cart-button="header-cart"
  type="text/javascript"
  src="https://elements.reservebar-worker.workers.dev/all/elements.js"
></script>

<div id="header-cart"></div>
```

### Cart button with badge

**Attribute:** `data-cart-badge-button`\
Renders a cart button with item count badge.

```html
<script
  defer
  data-liquid-commerce-elements
  data-token="YOUR_API_KEY"
  data-cart-badge-button="header-cart"
  type="text/javascript"
  src="https://elements.reservebar-worker.workers.dev/all/elements.js"
></script>
```

### Floating cart button

Provide the attribute with no value.

**Attribute:** `data-cart-button` (no value)\
Creates a floating cart button.

```html
<script
  defer
  data-liquid-commerce-elements
  data-token="YOUR_API_KEY"
  data-cart-button
  type="text/javascript"
  src="https://elements.reservebar-worker.workers.dev/all/elements.js"
></script>
```

### Positioning cart buttons

You can position the cart button relative to any element using:

* `inside:` (default)
* `above:`
* `below:`
* `replace:`

```html
<script
  defer
  data-liquid-commerce-elements
  data-token="YOUR_API_KEY"
  data-cart-button="above:.nav"
  type="text/javascript"
  src="https://elements.reservebar-worker.workers.dev/all/elements.js"
></script>
```

### Mobile-specific cart buttons

Use the mobile attributes to target mobile placement separately:

* `data-cart-mobile-button`
* `data-cart-mobile-badge-button`

**Attribute:** `data-cart-mobile-button`\
Places a mobile-specific cart button.

**Attribute:** `data-cart-mobile-badge-button`\
Places a mobile-specific cart button with badge.

```html
<script
  defer
  data-liquid-commerce-elements
  data-token="YOUR_API_KEY"
  data-cart-mobile-button="inside:#mobile-nav"
  type="text/javascript"
  src="https://elements.reservebar-worker.workers.dev/all/elements.js"
></script>
```

### Hide cart buttons entirely

**Attribute:** `data-cart-button-hidden`\
Disables auto-created cart buttons.

```html
<script
  defer
  data-liquid-commerce-elements
  data-token="YOUR_API_KEY"
  data-cart-button-hidden
  type="text/javascript"
  src="https://elements.reservebar-worker.workers.dev/all/elements.js"
></script>
```

### Cart toggle buttons (custom UI)

Any element with `data-lce-cart-toggle-button` will toggle the cart drawer.

**Attribute:** `data-lce-cart-toggle-button`\
Toggles the cart drawer on click.

```html
<button data-lce-cart-toggle-button>View Cart</button>
```

### Cart items count (custom UI)

Use `data-lce-cart-items-count` on any element to show item count.

**Attribute:** `data-lce-cart-items-count`\
Renders a live cart item count.

```html
<span data-lce-cart-items-count></span>
```

By default it hides when the cart is empty. To keep it visible with `0`, set:

```html
<span data-lce-cart-items-count="keep-zero"></span>
```

## 4) Checkout (hosted injection + checkout-only build)

Hosted checkout needs two things working together:

1. A **checkout URL** so the cart can redirect to your hosted checkout page.
2. A **checkout param name** so the hosted page can read the checkout token from the URL and load it.

### Checkout container

**Attribute:** `data-lce-checkout`\
Injects the hosted checkout into this container on the checkout page.

```html
<div data-lce-checkout></div>
```

### Hide checkout header

**Attribute:** `hide-header`\
Hides the SDK header so you can render your own header and layout.

```html
<div data-lce-checkout hide-header></div>
```

`hide-header` is a presence-only attribute — its value is ignored, so `hide-header="false"` still hides the header. Omit the attribute entirely to show the header.

### Exit checkout button

**Attribute:** `data-lce-exit-checkout`\
Lets you build your own “Exit checkout” UI. The SDK wires the click to the checkout exit action.

```html
<button data-lce-exit-checkout>Exit checkout</button>
```

### Checkout token query parameter (optional — defaults to lce\_checkout)

Use `data-checkout-param` on the script tag only if you want a custom query-param name; if omitted, the SDK reads the checkout token from `lce_checkout` by default.

**Attribute:** `data-checkout-param`\
Sets the query parameter name (must start with `lce_`). The hosted page reads this param to load the checkout.

```html
<script
  defer
  data-liquid-commerce-elements
  data-token="YOUR_API_KEY"
  data-checkout-param="lce_checkout"
  type="text/javascript"
  src="https://elements.reservebar-worker.workers.dev/all/elements.js"
></script>
```

### Checkout redirect URL (required for hosted checkout)

**Attribute:** `data-checkout-url`\
Defines the hosted checkout page URL pattern. The cart drawer redirects to this URL and injects the checkout token into `{token}`.

```html
<script
  defer
  data-liquid-commerce-elements
  data-token="YOUR_API_KEY"
  data-env="production"
  data-checkout-url="https://yoursite.com/checkout?lce_checkout={token}"
  data-checkout-param="lce_checkout"
  type="text/javascript"
  src="https://elements.reservebar-worker.workers.dev/all/elements.js"
></script>
```

### Checkout-only auto-initialize

Use the checkout-only build when you only need checkout on the hosted checkout page. It supports the same hosted-checkout attributes (`data-lce-checkout`, `data-checkout-param`, `hide-header`, `data-lce-exit-checkout`) but ships a smaller script for faster load time.

```html
<script
  defer
  data-liquid-commerce-elements
  data-token="YOUR_API_KEY"
  data-env="production"
  type="text/javascript"
  src="https://elements.reservebar-worker.workers.dev/checkout/checkout.js"
></script>
```

Supported attributes on checkout-only script:

* `data-token` (required)
* `data-env` (optional)
* `data-debug-mode` (optional, non-production only)
* `data-checkout-url` (optional)

The checkout-only build also supports `data-lce-checkout` containers and `data-checkout-param` query-parameter handling, and it reads the same `data-liquid-commerce-elements-development` and `data-liquid-commerce-elements-custom-theme` JSON script tags described in Section 6.

It also honors the Section 5 query-parameter product and promo attributes (`data-product-param`, `data-product-fulfillment-type-param`, `data-product-quantity-param`, `data-promo-code-param`), but with one difference: on this build the add-to-checkout call is deferred until the shopper's delivery address is resolved (the `lce:actions.address_updated` event) rather than being added immediately as on the main bundle.

## 5) Auto actions from query parameters

Auto-init can read query params to add a product or apply a promo code.

### Add product to cart via query params

* `data-product-param` (required)
* `data-product-fulfillment-type-param` (optional, `shipping` or `onDemand`)
* `data-product-quantity-param` (optional, integer > 0)

**Attribute:** `data-product-param`\
Name of query param that contains the product identifier (must start with `lce_`).

**Attribute:** `data-product-fulfillment-type-param`\
Name of query param that contains fulfillment type (must start with `lce_`).

**Attribute:** `data-product-quantity-param`\
Name of query param that contains the quantity to add (must start with `lce_`). The value must be an integer greater than `0`; otherwise the default of `1` is used.

```html
<script
  defer
  data-liquid-commerce-elements
  data-token="YOUR_API_KEY"
  data-product-param="lce_product"
  data-product-fulfillment-type-param="lce_fulfillment"
  data-product-quantity-param="lce_quantity"
  type="text/javascript"
  src="https://elements.reservebar-worker.workers.dev/all/elements.js"
></script>
```

Example URL:

```
https://yoursite.com?lce_product=00619947000020&lce_fulfillment=shipping&lce_quantity=2
```

### Preselect a product size on the product page

**Query parameter:** `lce_size`

On a product page, the `lce_size` query param preselects a size when the page loads. Unlike the params above, `lce_size` is a fixed name — it is not configured through a script attribute.

> Note: `lce_size` only takes effect on the product page (PDP). It is ignored in product lists.

Example URL:

```
https://yoursite.com/products/buffalo-trace?lce_size=750ml
```

See [Product → Preselect a size via URL](https://docs.liquidcommerce.cloud/elements-v2/product.md#preselect-a-size-via-url) for the full matching rules (case-insensitivity, punctuation, decimals, and pack sizes).

### Apply promo code via query params

* `data-promo-code-param`

**Attribute:** `data-promo-code-param`\
Name of query param that contains the promo code (must start with `lce_`).

```html
<script
  defer
  data-liquid-commerce-elements
  data-token="YOUR_API_KEY"
  data-promo-code-param="lce_promo"
  type="text/javascript"
  src="https://elements.reservebar-worker.workers.dev/all/elements.js"
></script>
```

Example URL:

```
https://yoursite.com?lce_promo=SUMMER20
```

## 6) Advanced script options (optional)

These are supported but not required for most implementations.

### Promo ticker

All four required attributes below must be present to enable the promo ticker.

**Required:** `data-promo-code`, `data-promo-text`, `data-promo-active-from`, `data-promo-active-until`\
**Optional:** `data-promo-separator` (defaults to `•`)\
`data-promo-text` is pipe-separated (e.g. `"Text A|Text B"`).

```html
<script
  defer
  data-liquid-commerce-elements
  data-token="YOUR_API_KEY"
  data-env="production"
  data-promo-code="SUMMER20"
  data-promo-text="20% Off|Free shipping over $50"
  data-promo-separator="•"
  data-promo-active-from="2026-06-01T00:00:00Z"
  data-promo-active-until="2026-08-31T23:59:59Z"
  type="text/javascript"
  src="https://elements.reservebar-worker.workers.dev/all/elements.js"
></script>
```

### Development config

For local development or testing, you can inject development overrides via a JSON script tag:

**Attribute:** `data-liquid-commerce-elements-development`\
Reads JSON for development overrides.

```html
<script data-liquid-commerce-elements-development type="application/json">
{
  "customApiUrl": "http://localhost:3000/api",
  "openShadowDom": true,
  "mockMode": true
}
</script>
```

Setting `mockMode` to `true` sends an `X-Liquid-Api-Mock-Mode` header with every API request so the backend returns mock data instead of live data. See [Advanced](https://docs.liquidcommerce.cloud/elements-v2/advanced.md) for the full set of development config options.

### Custom theme config

To override the default theme, provide a custom theme via a JSON script tag. It is parsed into the `customTheme` config.

**Attribute:** `data-liquid-commerce-elements-custom-theme`\
Reads JSON for custom theme overrides.

```html
<script data-liquid-commerce-elements-custom-theme type="application/json">
{
  "global": {
    "theme": {
      "primaryColor": "#1a1a1a",
      "accentColor": "#c9a227"
    }
  }
}
</script>
```

***

**Next:** [Product](https://docs.liquidcommerce.cloud/elements-v2/product.md)
