> For the complete documentation index, see [llms.txt](https://subscriptionsuite.gitbook.io/helpdoc/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://subscriptionsuite.gitbook.io/helpdoc/getting-started/integrations/storefront-js-api.md). Agents can also search and read this documentation through its [MCP server](https://subscriptionsuite.gitbook.io/helpdoc/~gitbook/mcp).

# Storefront JS API

The SubscriptionSuite Storefront JS API lets developers access subscription information directly from a Shopify theme using JavaScript.

You can use it to read subscription plans, prices, the shopper's current selection, and subscription-related events.

> **For developers:** This is an advanced feature intended for custom storefront integrations.

<figure><img src="https://4127174298-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2b41HkDs75AWk1ddL9M2%2Fuploads%2FhSA1MY6b8QTBVUNhJJDe%2Fimage.png?alt=media&amp;token=fb607ab5-0292-4dd9-8dc1-1ff4d798285c" alt=""><figcaption></figcaption></figure>

***

### 🔐 Request Access

The Storefront JS API is not enabled automatically.

To request access:

1. Go to **SubscriptionSuite → Integrations → Storefront JS API**
2. Click **Request access**
3. Our team will review the request.
4. Once approved, the API becomes available (Shown in the screenshow below).

<figure><img src="https://4127174298-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2b41HkDs75AWk1ddL9M2%2Fuploads%2F7cq6W9rOHIg3fnmaTPxR%2Fimage.png?alt=media&amp;token=bb1441e6-852a-4aee-b7f6-2adfa38c4487" alt=""><figcaption></figcaption></figure>

Until access is approved, the API may still load, but subscription plans will return as an empty list.

***

### ⚙️ Before You Start

Make sure:

* SubscriptionSuite is installed.
* The **SubscriptionSuite App Embed** is enabled.
* Storefront JS API access is **Approved**.
* The product has an active subscription plan.
* You're using a supported page.

#### Supported pages

The API works on:

* Product pages
* Collection pages
* Cart pages
* Home page

It is not available on other page types such as blog articles, search results, or custom pages.

***

### 🚀 Basic Setup

#### 1. Enable the App Embed

Go to:

**Online Store → Themes → Customize → App embeds**

Enable **SubscriptionSuite**.

#### 2. Create a JavaScript file

Go to:

**Online Store → Themes → Edit code → Assets**

Create:

```
subscriptionsuite-custom.js
```

#### 3. Add it to your theme

Open:

**layout/theme.liquid**

Add this before `</head>`:

```
{{ 'subscriptionsuite-custom.js' | asset_url | script_tag }}
```

***

### 📚 What Can You Do?

| Method             | Purpose                                        |
| ------------------ | ---------------------------------------------- |
| `getPlans()`       | Get available subscription plans               |
| `getPrice()`       | Get the exact subscription price               |
| `isSubscribable()` | Check whether a product supports subscriptions |
| `getSelection()`   | Get the shopper's current selection            |

The API is **read-only**. It cannot directly pause, skip, cancel, or modify subscriptions.

***

### 🔔 Subscription Events

You can listen for:

* `subscriptionsuite:ready`
* `subscriptionsuite:plan-selected`
* `subscriptionsuite:price-updated`
* `subscriptionsuite:added-to-cart`

These can be used for custom UI, analytics, and storefront behavior.

***

### 💡 Common Use Cases

Developers can use the API to create:

* Subscribe & Save badges
* Custom subscription price displays
* Custom subscription CTAs
* Subscription analytics
* Custom UI based on the selected plan
* Custom subscription cart experiences

***

### ⚠️ Important

The API is currently **v1.0**.

Some important limitations:

* Read-only API
* Supported pages only
* `getSelection()` requires the SubscriptionSuite widget
* `getPrice()` works only on product pages
* Prepaid plans don't have a separate per-delivery price
* `added-to-cart` only detects standard form submissions
