> Add Plandalf to a Squarespace site with Code Injection, then add checkout buttons with a Code Block.

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

Websites and builders

# Squarespace

Paste the Plandalf script into Squarespace's Code Injection once, then add a checkout button or an inline checkout to any page with a Code Block.

**Before you start**

Code Injection needs a Core plan or higher (Business or Commerce on older plans). On the Basic plan, use a [hosted checkout link](https://plandalf.com/docs/checkouts/links) on a normal button instead.

## Add the script

These are the install steps for Squarespace. Copy the script from your checkout's **Share** screen (pick **HTML**) so it holds your own address.

1.  ### Install the SDK
    
    Settings → Advanced → Code Injection. Paste in Footer.
    
    ```html
    <script async src="https://YOUR-ORG.plandalf.dev/js/plandalf-sdk.js"></script>
    ```
    
2.  ### Add the trigger button
    
    Edit the page → Add Block → Code. Paste the HTML and turn OFF "Display Source".
    
    ```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>
    ```
    

Step 1's menu path is from older Squarespace menus. Today, open the **Pages** panel, scroll to **Website Tools** and click **Code Injection**. Paste the script into **Footer** and click **Save**. It then loads on every page. Squarespace's checkout pages don't run custom code.

## Open a checkout from a button

Edit the page, click **Add Block → Code** and paste the button. Turn off **Display Source** so visitors see a button, not the code.

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

To match your site's buttons, add Squarespace's button class, for example `class="sqs-block-button-element"`. More options are in [Buy buttons](https://plandalf.com/docs/checkouts/buy-buttons).

## Show a checkout on the page

Add a **Code** block where the checkout should appear, turn off **Display Source** and paste:

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

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

## Show a deadline timer

Add a Code 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 the live site
    
    Use a private window, so you see what a buyer sees. If you turned on **Disable Scripts in Preview**, the editor won't run the script, but visitors still get it. 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 built-in address, such as `your-site.squarespace.com`, in Plandalf under **Settings → Advanced → Test domains**. Checkouts there use Stripe test cards while your custom domain stays live. See [Test mode](https://plandalf.com/docs/get-started/test-mode).
    

## If it isn't working

-   If you see the code as text, open the Code block and turn off **Display Source**.
-   Check the script is in Code Injection's **Footer**, saved, and that your plan includes Code Injection.
-   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).
