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

# Address

The Address component sets the delivery location used for availability, pricing, and fulfillment options.

## How it works

* Address is embedded in the Product component by default
* If a user adds to cart without an address, the SDK prompts automatically
* The address is reused across product, cart, and checkout
* If you also inject a standalone Address component (via `injectAddressElement`) elsewhere on the page, the Product component automatically hides its own embedded address display to avoid duplicate UI — both still read/write the same shared address state.

## Standalone address component

```js
const client = await Elements('YOUR_API_KEY', { env: 'production' });
await client.injectAddressElement('address', {
  showLabel: true
});
// To react to address changes, listen for the `lce:actions.address_updated` event.
```

## Address actions

```js
await window.LiquidCommerce.elements.actions.address.setAddressByPlacesId('ChIJOwg_06VPwokRYv534QaPC8g');

await window.LiquidCommerce.elements.actions.address.setAddressManually(
  {
    one: '123 Main Street',
    two: 'Apt 4',
    city: 'New York',
    state: 'NY',
    zip: '10001',
    country: 'US'
  },
  { latitude: 40.7128, longitude: -74.0060 }
);

const address = window.LiquidCommerce.elements.actions.address.getDetails();
await window.LiquidCommerce.elements.actions.address.clear();
```

## Address events (examples)

```js
window.addEventListener('lce:actions.address_updated', (event) => {
  const { formattedAddress } = event.detail.data;
});

window.addEventListener('lce:actions.address_failed', (event) => {
  const { error } = event.detail.data;
});
```

***

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