> For the complete documentation index, see [llms.txt](https://docs.getpurpledot.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.getpurpledot.com/e-commerce-platforms/shopify/integrate-with-hydrogen.md). Agents can also search and read this documentation through its [MCP server](https://docs.getpurpledot.com/~gitbook/mcp).

# Integrate with Hydrogen

Install @purple-dot/browser in a Hydrogen storefront and open combined checkout.

Hydrogen storefronts use combined checkout and the Storefront API cart. See [Combined cart](https://docs.getpurpledot.com/understanding-purple-dot/choosing-a-checkout-method.md#combined-cart).

## Before you start

* You have a Hydrogen storefront and its Storefront API public access token and shop domain.
* You have the public API key from **Settings** > **Integrations** in the Merchant Portal.
* The store uses the Purple Dot checkout. To change the method, contact us.

## Steps

1. Install the package:

```bash
npm install @purple-dot/browser
```

2. Let the Hydrogen Vite build include the package.

```ts
export default defineConfig({
  ssr: {
    optimizeDeps: {
      include: ['@purple-dot/browser/*'],
    },
  },
});
```

3. Store the public API key where the storefront can read it, next to the shop domain and Storefront API token you already use.
4. Initialize the package on the server and in the browser with `ShopifyStorefrontCart`. The constructor takes the shop domain, then the Storefront API public access token. See [Set up combined checkout with Hydrogen](https://docs.getpurpledot.com/e-commerce-platforms/shopify/integrate-with-hydrogen/combined-checkout.md) for the product page, cart attributes, and checkout.

## Verify

A variant in state `ON_PREORDER` shows **Pre-order** and the ship dates. Adding it puts `__releaseId` on the cart line, and checkout opens the Purple Dot checkout.

## Troubleshooting

* [The pre-order button is not showing](https://docs.getpurpledot.com/troubleshooting/storefront-and-checkout/pre-order-button-is-not-showing.md)

## Related

* **Concept:** [How Purple Dot works with Shopify](https://docs.getpurpledot.com/e-commerce-platforms/shopify/how-purple-dot-works-with-shopify.md)
* **Do this:** [Set up combined checkout with Hydrogen](https://docs.getpurpledot.com/e-commerce-platforms/shopify/integrate-with-hydrogen/combined-checkout.md)
* **Look up:** [Public API](https://docs.getpurpledot.com/purple-dot-apis/public-api.md)


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.getpurpledot.com/e-commerce-platforms/shopify/integrate-with-hydrogen.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
