> 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/product.md). Agents can also search and read this documentation through its [MCP server](https://docs.liquidcommerce.cloud/~gitbook/mcp).

# Product

The Product component renders a complete product view with images, pricing, fulfillment options, and add-to-cart.

## What you get

* Image carousel
* Name, description, pricing
* Size selection (if applicable)
* Fulfillment type selection (shipping or on-demand)
* Retailer selection (when multiple retailers are available)
* Personalization/engraving (when supported)
* Quantity controls
* Location-based availability and pricing

## Add a product (CDN, declarative)

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

<div id="product"></div>
```

## Add a product (programmatic)

```js
const client = await Elements('YOUR_API_KEY', { env: 'production' });
await client.injectProductElement([
  { containerId: 'product', identifier: '00619947000020' }
]);
```

> Note: `injectProductElement` accepts at most 20 products per call — any beyond the 20th are silently dropped (with a console warning), not rendered. For larger grids, use `injectProductList` or split the call into batches of 20. See [Injection methods](https://docs.liquidcommerce.cloud/elements-v2/overview.md#injection-methods) for the full set of injection methods.

## Identifiers

Use any of the supported identifiers:

* UPC
* Grouping ID

The SDK resolves the correct product automatically.

## Preselect a size via URL

Use the `lce_size` query parameter to preselect a size when the product page loads:

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

The value is compared against each size's full label as shown on the page. Matching is case-insensitive and ignores spacing and punctuation — only letters, digits, and decimal points are compared — so `750 ML`, `750ml`, and `750ML` all select a `750ml` size, while decimals are kept so `1.0L` and `1.75L` stay distinct. If the value matches no size, the default size selection is used.

**Pack sizes:** the label includes the pack description when present (e.g. `50 ML (12PK)`). To select that size, include the pack in the value:

```
https://yoursite.com/products/mini-bottles?lce_size=50ml(12pk)
```

`50ml(12pk)` and `50ml12pk` both match `50 ML (12PK)` (punctuation is ignored). A value of just `50ml` only matches a size whose label is `50 ML` with no pack.

`lce_size` is a fixed parameter name (not configured via a script attribute) and only applies to the product page. See [Quick start guide](https://docs.liquidcommerce.cloud/elements-v2/quick-start-guide.md) for all supported query parameters.

## Product actions

```js
const product = window.LiquidCommerce.elements.actions.product.getDetails('00619947000020');
console.log(product.name, product.priceInfo?.average);
```

## Product events (examples)

```js
window.addEventListener('lce:actions.product_loaded', (event) => {
  const { identifier, name, priceInfo } = event.detail.data;
});

window.addEventListener('lce:actions.product_add_to_cart', (event) => {
  const { identifier, quantity, fulfillmentId, partNumber } = event.detail.data;
});
```

## Image backgrounds

Product images automatically have their white/near-white backgrounds removed so photos blend into the host page background. This is applied across all product surfaces and is not currently configurable.

## Address requirement

If an address is required for availability, the SDK automatically prompts the user to set it before adding to cart.

***

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