> Add Plandalf to a WordPress site with a footer plugin or your theme, then add checkout buttons with a Custom HTML block.

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

Websites and builders

# WordPress

Load the Plandalf script in your site's footer once, then add a checkout button or an inline checkout to any page or post with a Custom HTML block. It works with the block editor, Elementor, Divi and classic themes.

**Selling memberships?**

If MemberPress controls access on your site, use the [MemberPress plugin](https://plandalf.com/docs/websites/memberpress) instead. It puts your checkout on each membership page and gives buyers their membership when they pay.

## Add the script

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

1.  ### Install the SDK
    
    Use a footer-injection plugin (e.g. "Insert Headers and Footers") or your theme's footer code setting.
    
    ```html
    <script async src="https://YOUR-ORG.plandalf.dev/js/plandalf-sdk.js"></script>
    ```
    
2.  ### Add the trigger button
    
    Edit the page, add a Custom HTML block, paste the snippet.
    
    ```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**

Works with Gutenberg, Elementor, Divi — all of them respect raw HTML blocks.

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

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

### Where the footer code goes

A code plugin is the safest place, because theme updates don't remove it. With WPCode (the plugin formerly called Insert Headers and Footers), go to **Code Snippets → Header & Footer** and paste the script into **Footer**. If your theme has its own footer code setting, that works too.

You can also paste the script just before `</body>` in your theme's `footer.php`, ideally in a child theme. Block themes such as Twenty Twenty-Four have no `footer.php`, so use a plugin there. On WordPress.com, adding plugins needs a plan that allows them.

## Open a checkout from a button

Edit the page, add a **Custom HTML** block and paste the button:

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

In Elementor use the **HTML** widget. On a Divi site, follow the [Divi guide](https://plandalf.com/docs/websites/divi): a Divi 5 Button module can open the checkout itself. To restyle the button, add your theme's button class, for example `class="wp-element-button"`. Any element works: a link or an image can carry `data-plandalf-present` too. More options are in [Buy buttons](https://plandalf.com/docs/checkouts/buy-buttons).

## Show a checkout on the page

Add a **Custom HTML** block where the checkout should appear 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 Custom HTML 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 page on the front of your site
    
    Use a private window, not WP admin or the editor preview. Elementor and Divi previews can show markup the live page doesn't. 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 staging site, or `localhost`, in Plandalf under **Settings → Advanced → Test domains**. Checkouts there use Stripe test cards while your live site stays live. See [Test mode](https://plandalf.com/docs/get-started/test-mode).
    

## If it isn't working

-   Caching and speed plugins (WP Rocket, LiteSpeed Cache, W3 Total Cache, Autoptimize) can delay, combine or strip scripts. Exclude `plandalf-sdk.js` from JavaScript delay and combining, then purge the cache.
-   If the script disappears after a theme update, move it from `footer.php` to a code plugin.
-   Check the block kept the `data-plandalf-present` attribute. Some editors strip unknown attributes from rich text, which is why the Custom HTML block is the reliable choice.
-   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).
