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

# Integrate with a Liquid theme

Turn on the Purple Dot theme embed and meet the product-form requirements for a Liquid theme.

For which embed your store uses, see [How Purple Dot works with Shopify](https://docs.getpurpledot.com/e-commerce-platforms/shopify/how-purple-dot-works-with-shopify.md#the-theme-embed).

## Before you start

* The Purple Dot app is installed. See [Install the Purple Dot app](https://docs.getpurpledot.com/e-commerce-platforms/shopify/install-the-purple-dot-app.md).
* For the Purple Dot checkout, copy **Public API Key** and **Shared Secret** from **Settings** > **Integrations** in the Merchant Portal.

## Steps

{% tabs %}
{% tab title="Purple Dot checkout" %}

1. In Shopify admin, go to **Online Store** > **Themes**.
2. On the theme you want to test, select **Edit theme**, then **App embeds**.
3. Search for **Purple Dot**.
4. Enter **Purple Dot API Key** and **Purple Dot Shared Secret**.
5. Turn the embed on and save the theme.
   {% endtab %}

{% tab title="Native checkout" %}

1. In Shopify admin, go to **Online Store** > **Themes**.
2. On the theme you want to test, select **Edit theme**, then **App embeds**.
3. Search for **Purple Dot Pre-orders**.
4. Turn the embed on and save the theme.
   {% endtab %}
   {% endtabs %}

## Add the shopper page

Shoppers manage a pre-order from a page on your store. Create a page titled **Manage Pre-orders** and add this element to the page HTML:

```html
<purple-dot-self-service />
```

In the Merchant Portal, go to **Settings** > **Email** and set **Cancel link** to that page. The link must start with `https://`. See [Customize shopper emails](https://docs.getpurpledot.com/set-up-and-launch/checkout-and-shopper-experience/customize-shopper-emails.md).

## Optional: place the separate cart

Use this only when the store's checkout method is separate cart. Set `window.PurpleDotConfig` before the embed loads, and return the element that should hold the cart icon:

```js
window.PurpleDotConfig = {
  cart: {
    fill: '#000000',
    strokeWidth: '1.5px',
    matchFill: '.icon--cart',
    width: '22px',
    height: '22px',
    placeElement: (cartElement, cartLink) => {
      const cartLinkContainer = cartLink.parentElement;
      const container = cartLinkContainer.cloneNode();
      container.appendChild(cartElement);
      cartLinkContainer.insertAdjacentElement('beforebegin', container);
      return container;
    },
  },
};
```

If a product page marks a pre-order variant as unavailable, point `pdp.variantSelector` at those controls. `selector` is queried inside the add-to-cart form. `find` is for controls outside that form. `disabledClass` is the class Purple Dot removes.

```js
window.PurpleDotConfig = {
  pdp: {
    variantSelector: {
      selector: '.some-selector',
      find: (addToCartForm) => addToCartForm.querySelectorAll('.another-selector'),
      disabledClass: 'disabled',
    },
  },
};
```

The theme editor has no field for `window.PurpleDotConfig`. Add the script that sets it to the `<head>` of your theme's `theme.liquid`, so it runs before the Purple Dot app embed, which merges your values with its own.

## Verify

Open a product that has a live waitlist and no Shopify stock. The add-to-cart control offers a pre-order, and checkout follows the method Purple Dot set for the store. See [Test your setup](https://docs.getpurpledot.com/set-up-and-launch/test-your-setup.md).

## Troubleshooting

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

## Minimum theme requirements

Purple Dot finds the product form on a Liquid theme from three pieces of markup:

| Requirement | What the theme must render                                                                                                                |
| ----------- | ----------------------------------------------------------------------------------------------------------------------------------------- |
| Add to cart | A `button` with `type="submit"` inside the product form                                                                                   |
| Form action | A `form` whose `action` contains `/cart/add`                                                                                              |
| Variant id  | An `input` or `select` named `id`, updated to the selected variant. For a `select`, only the selected option has the `selected` attribute |

On a product page, this check should log three `true` values:

```javascript
const form = document.querySelector('form[action*="/cart/add"]');
const variantID = form?.querySelector('[name="id"]');
const button = form?.querySelector('button[type="submit"]');

console.log(!!form);
console.log(!!variantID);
console.log(!!button);
```

## 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:** [Test your setup](https://docs.getpurpledot.com/set-up-and-launch/test-your-setup.md)
* **Fix it:** [The pre-order button is not showing](https://docs.getpurpledot.com/troubleshooting/storefront-and-checkout/pre-order-button-is-not-showing.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-a-liquid-theme.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.
