> Add Plandalf to a Shopify theme to sell upsells, subscriptions and limited-time offers beside your Shopify cart.

Source: https://plandalf.com/docs/websites/shopify

Websites and builders

# Shopify

Add the Plandalf script to your Shopify theme and you can sell an offer from any product page, landing page or section, beside your normal Shopify cart. It suits upsells, memberships, courses and limited-time offers that don't belong in the cart.

**Plandalf runs beside your store, not inside Shopify's checkout**

Shopify's own checkout pages don't run theme scripts, so Plandalf buttons live on your storefront pages. A Plandalf purchase goes through the payment account you connected to Plandalf, and it doesn't create a Shopify order.

## Add the script

These are the steps your checkout's **Share** screen shows for Shopify. Copy the snippets from there and they already hold your script address and checkout slug.

1.  ### Install the SDK
    
    Online Store → Themes → Edit Code. Open theme.liquid and paste the script tag right before </body>.
    
    ```html
    <script async src="https://YOUR-ORG.plandalf.dev/js/plandalf-sdk.js"></script>
    ```
    
2.  ### Add the trigger button
    
    Edit the page or section where you want the checkout. Paste the HTML directly.
    
    ```html
    <button data-plandalf-present="YOUR-CHECKOUT">Buy Now</button>
    ```
    
3.  ### Make the first open instant (optional)
    
    Paste this under the SDK script tag on the pages that hold the trigger. It fetches the checkout UI (about 1.2 MB) in the background while the page sits idle, so the click only pays for creating the session. Leave it off pages with no checkout: visitors download it whether or not they buy. In a React app, call sdk.preload('checkout') from the ready callback in an effect instead.
    
    ```html
    <script>
      // Optional: fetch the checkout UI while the page is idle, so the first click opens at once.
      window.plandalf = window.plandalf || function () { (window.plandalf.q = window.plandalf.q || []).push(arguments); };
      plandalf('ready', (sdk) => sdk.preload('checkout'));
    </script>
    ```
    

**Tip**

Shopify's own /checkout pages run on a separate domain and won't execute theme scripts, so Plandalf buttons live on product and landing pages.

[![The Share screen's Install steps with Shopify picked: the script tag, where it goes in theme.liquid, and the trigger button](https://plandalf.com/docs/shots/platforms/share-shopify.webp)](https://plandalf.com/docs/shots/platforms/share-shopify.webp)

Pick Shopify on your checkout's Share screen to get these steps with your own script and checkout slug.

To open the code editor, go to **Online Store → Themes**, click **…** next to your current theme and choose **Edit code**. Open `layout/theme.liquid`, paste the script just before `</body>` and click **Save**. If you switch themes later, add it to the new theme too.

## Open a checkout from a button

In the theme editor (**Online Store → Themes → Customize**), add a **Custom Liquid** section or block where the button should go and paste:

```html
<button data-plandalf-present="YOUR-CHECKOUT">Buy Now</button>
```

Click **Save**. To match your theme's buttons, add its button class, for example `class="button"`. You can also paste the button into a page's HTML view or a product template. More options are in [Buy buttons](https://plandalf.com/docs/checkouts/buy-buttons).

## Show a checkout on the page

Add a **Custom Liquid** section where the checkout should appear and paste:

```html
<div data-plandalf-mount="YOUR-CHECKOUT" style="min-height: 480px"></div>
```

The checkout fills the section. Change `min-height` to suit your layout.

## Show a deadline timer

Add a Custom Liquid block with an empty element that has your deadline timer's slug. The script draws the live countdown inside it. To charge the deadline timer's current price, add `data-plandalf-apply-promo` with the same slug to your buy button.

```html
<div data-plandalf-promo="YOUR-PROMO"></div>
<button data-plandalf-present="YOUR-CHECKOUT" data-plandalf-apply-promo="YOUR-PROMO">Buy Now</button>
```

See [Countdowns](https://plandalf.com/docs/promos/countdowns).

## Check it's working

1.  ### Open your storefront
    
    Use your `.myshopify.com` address or your domain in a private window, not the theme editor's preview, which can lag behind saved code. In the browser console, type `plandalf`: you should see a function. `undefined` means the script isn't on the page.
    
2.  ### Click your button
    
    The checkout opens over the page.
    
3.  ### Make a test purchase
    
    Add `your-store.myshopify.com` in Plandalf under **Settings → Advanced → Test domains** while you test, and remove it before launch if buyers use that address. See [Test mode](https://plandalf.com/docs/get-started/test-mode).
    

## If it isn't working

-   Shopify caches theme files. Hard-refresh the storefront after you save `theme.liquid` (Shift + Cmd + R on a Mac).
-   Check you edited the published theme, not a draft copy.
-   A button on Shopify's cart or checkout pages won't work. Put it on a product, collection or landing page.
-   Add `data-debug="true"` to the script tag and the console logs each step the script takes.

See [Troubleshooting](https://plandalf.com/docs/help/troubleshooting).

Something wrong or missing? Email [hello@plandalf.com](mailto:hello@plandalf.com).
