> For the complete documentation index, see [llms.txt](https://docs.elitebundleapp.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.elitebundleapp.com/reference/globals.md).

# Global object

Reference for window\.eliteBundle: shop-level values, the current bundle data and the optional SDK object exposed on Shopify bundle pages.

```ts
window.eliteBundle = {
  version: string;
  app:  EliteBundleApp;          // shop-level values
  byob: BundleData | null;       // this page's bundle, if any
  sdk?: { byob: BundleSDK | null };
  on(event: string, cb: EventListener): void;
  off(event: string, cb: EventListener): void;
}
```

Two things load at different times, which matters if your script runs early:

* **`app` and `byob`** are written by the theme app embed in `<head>`, so they are there before any other JavaScript runs.
* **`version`, `sdk`, `on` and `off`** are added by the bundle script, which is deferred. `window.eliteBundle` can therefore exist while `sdk` is still undefined.

Never treat a missing `sdk` as "SDK access is off" — wait for `elite:byob:ready` on `document` instead. See [Event timing](/reference/events.md#event-timing).

`sdk` is only populated when SDK access is enabled in **Settings → Developer SDK**. Always use `window.eliteBundle.sdk?.byob`.

> The global carries a few internal keys beyond those listed here. They back the app's own storefront behaviour, are not part of the public API, and can change without notice — please do not build on anything undocumented.

***

## `app`

Shop-level values, available synchronously.

| Field                   | Type             | Description                                                                                                 |
| ----------------------- | ---------------- | ----------------------------------------------------------------------------------------------------------- |
| `shopDomain`            | `string`         | The storefront domain the page was requested on                                                             |
| `moneyFormat`           | `string`         | Shopify money format string, e.g. `"${{amount}}"`                                                           |
| `currencyCode`          | `string`         | ISO 4217 currency code of the buyer's active currency                                                       |
| `currencyRate`          | `number`         | Exchange rate from the shop's base currency to the buyer's. `1` when they match. Added by the bundle script |
| `countryCode`           | `string`         | ISO 3166-1 alpha-2 market country                                                                           |
| `locale`                | `string`         | Buyer's active language ISO code, e.g. `"en"`                                                               |
| `storefrontAccessToken` | `string \| null` | Storefront API token, if you need to make your own Storefront API calls                                     |
| `sdkEnabled`            | `boolean`        | Whether SDK access is enabled for this shop                                                                 |

```js
const { moneyFormat, currencyCode, locale } = window.eliteBundle.app;
```

Other fields on `app` reflect internal setup state and are not part of the public API.

***

## `byob`

The bundle on the current page — **for both bundle types**. It is `null` (or absent, before the bundle script runs) on any page without a bundle, so always guard access.

| Field              | Type                       | Description                                                    |
| ------------------ | -------------------------- | -------------------------------------------------------------- |
| `bundleConfig`     | `object`                   | The bundle's stored configuration, in an internal encoded form |
| `shopifyVariantId` | `number \| string \| null` | Variant ID of the bundle product                               |
| `productId`        | `string`                   | Shopify product ID. Stable identifier for this bundle          |

```js
const bundle = window.eliteBundle.byob;
if (bundle) {
  console.log(bundle.productId);
}
```

> **`bundleConfig` is not a public API.** It is a compact encoded form written for the storefront's own decoder — keys are abbreviated and products are stored as bare IDs with no titles, images or prices. Its shape can change without notice. For anything you want to read or render, use the [Bundle SDK](/reference/sdk.md), which gives you the same data fully resolved.

***

## `on` / `off`

Convenience wrappers around `document.addEventListener` / `removeEventListener`. Added by the bundle script, so early theme code should call `document.addEventListener` directly.

```js
function handleCartChange(event) {
  updateMyCartUI(event.detail.cart);
}

window.eliteBundle.on('elite:byob:cart-change', handleCartChange);
window.eliteBundle.off('elite:byob:cart-change', handleCartChange);
```

See the [Events Reference](/reference/events.md) for every available event.


---

# 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 dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.elitebundleapp.com/reference/globals.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
