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

# Set up combined checkout with React Native

Add pre-order line attributes in a React Native app and open combined checkout in a WebView.

For initialization, see [Integrate with React Native](https://docs.getpurpledot.com/e-commerce-platforms/shopify/integrate-with-react-native.md).

## Before you start

* `@purple-dot/browser` is initialized with `ShopifyStorefrontCart`.
* The app can add Storefront API cart lines and open a WebView.

## Steps

1. Before adding a variant, read its pre-order state. `fetchVariantsPreorderState` accepts the numeric Shopify variant id.

```js
import * as api from '@purple-dot/browser/api';

const variantState = await api.fetchVariantsPreorderState(variantId);
```

When `state` is `ON_PREORDER`, label the control **Pre-order** and show `waitlist.display_dispatch_date`. When it is `SOLD_OUT`, disable the control. `<purple-dot-learn-more />` is a browser element, so it doesn't render in native React Native views. Show the ship date in your own component instead.

If the store uses [location-aware waitlists](https://docs.getpurpledot.com/understanding-purple-dot/inventory-and-virtual-locations.md#location-aware-waitlists), pass the shopper's country code as the second argument, such as `fetchVariantsPreorderState(variantId, 'GB')`. See [Show pre-order state on a product page](https://docs.getpurpledot.com/e-commerce-platforms/other-and-custom/show-pre-order-state-on-a-product-page.md).

2. Add the line through the Storefront API with these attributes when the state is `ON_PREORDER`:

| Attribute              | Value                            |
| ---------------------- | -------------------------------- |
| `__releaseId`          | `waitlist.id`                    |
| `Purple Dot Pre-order` | `waitlist.display_dispatch_date` |

Use the Storefront API version the app already uses. Show `Purple Dot Pre-order` on the cart line.

You can build the same attributes with `purpleDotAttributes` from `@purple-dot/browser/cart`. Pass `isPreorder`, `releaseId`, `estimatedShipDates`, and `sellingPlanId` and `compatibleCheckouts` when the response includes them. When `selling_plan_id` is set, the helper omits `Purple Dot Pre-order`.

3. Open checkout only when the cart has a pre-order:

```js
import { cartHasPreorderItem } from '@purple-dot/browser/cart';

const hasPreorder = await cartHasPreorderItem(cartLines);
```

`cartLines` need `attributes` of `{ key, value }`. The check looks for `__releaseId`.

4. Load the hosted checkout in a WebView. `apiKey` and `cartId` are required. `cartId` is the Storefront cart GID. Optional query parameters are `currency`, `locale`, and `salesChannel`.

`https://www.purpledotprice.com/embedded/placements/checkout/combined`

The page posts `pd:checkout_opened` when the checkout opens and `pd:checkout_closed` when it closes, through `ReactNativeWebView.postMessage`. Read those strings from the WebView `onMessage` event.

The hosted page fails if the store has no Storefront API public access token on file. See [Integrate with React Native](https://docs.getpurpledot.com/e-commerce-platforms/shopify/integrate-with-react-native.md).

5. Host `<purple-dot-self-service />` on a page shoppers can open from the email **Cancel link**. The link opens in a browser, so host the element on a web page, for example a **Manage Pre-orders** page on your storefront. See [Customize shopper emails](https://docs.getpurpledot.com/set-up-and-launch/checkout-and-shopper-experience/customize-shopper-emails.md).

## Verify

The cart line includes `__releaseId`. The WebView loads the combined checkout for that `cartId`, and closing it delivers `pd:checkout_closed`.

## 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:** [Combined cart](https://docs.getpurpledot.com/understanding-purple-dot/choosing-a-checkout-method.md#combined-cart)
* **Do this:** [Integrate with React Native](https://docs.getpurpledot.com/e-commerce-platforms/shopify/integrate-with-react-native.md)
* **Look up:** [Set up combined checkout for a headless storefront](https://docs.getpurpledot.com/e-commerce-platforms/shopify/integrate-with-a-headless-storefront/combined-checkout.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-react-native/combined-checkout.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.
