> Add a Plandalf checkout to a Divi site. Paste the script into Divi's Theme Options once, then give a Button module one attribute or use a Code module.

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

Websites and builders

# Divi

Paste the Plandalf script into Divi's Theme Options once, and any Divi button can open your checkout.

In Divi 5 you give the Button module one attribute, so the button keeps the design you gave it in Divi. A Code module holds an inline checkout, a deadline timer, or the button itself on Divi 4. You don't need a plugin.

**Selling memberships?**

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

## Add the script

Copy the script from your checkout's **Share** screen (pick **Divi**) so it holds your own address.

1.  ### Open the Integration tab
    
    In WordPress, go to **Divi → Theme Options** and open the **Integration** tab.
    
2.  ### Paste the script into the body code
    
    Enable the body code and add the script to it, then save. Divi adds body code to every page of the site. In Divi 4 the fields are **Enable body code** and **Add code to the < body >**.
    

```html
<script async src="https://YOUR-ORG.plandalf.dev/js/plandalf-sdk.js"></script>
```

If your site doesn't have **Divi → Theme Options**, for example because it runs the Divi Builder plugin on another theme, add the script with a code plugin as the [WordPress guide](https://plandalf.com/docs/websites/wordpress) shows. The button and Code module steps below stay the same.

## Open a checkout from a Divi button

In Divi 5, modules have an **Attributes** group where you can add custom HTML attributes, so Divi's own Button module can open your checkout.

1.  ### Add a Button module
    
    Add a **Button** module, or open one you already have, and set its text.
    
2.  ### Add the attribute
    
    Open the module's **Advanced** tab, then **Attributes**, and click **\+ Add Attribute**. Choose the **Target Element** (Elegant Themes' guide says this is usually the Module). Type `data-plandalf-present` as the **Attribute Name** and your checkout's slug as the **Attribute Value**.
    
3.  ### Save and try it
    
    Save the page, open the published page and click the button. Plandalf opens the checkout over the page instead of following the button's link.
    

```
data-plandalf-present = YOUR-CHECKOUT
```

The Share screen lists the exact attribute rows for your checkout. If you picked any frame other than the centred box, one of them is `data-plandalf-frame`. More options are in [Buy buttons](https://plandalf.com/docs/checkouts/buy-buttons).

### On Divi 4

Divi 4's Button module has no custom attributes. Add a **Code** module where the button goes and paste the button into its **Text** box:

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

## Show a checkout on the page

Add a **Code** module where the checkout should appear and paste an inline checkout into its **Text** box:

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

Change `min-height` to suit your layout.

## Show a deadline timer

In a **Code** module, add an empty element with your deadline timer's slug. The script draws the live countdown inside it.

```html
<div data-plandalf-promo="YOUR-PROMO"></div>
```

To charge the deadline timer's current price, add `data-plandalf-apply-promo` with the same slug to your buy button. On a Divi 5 Button module, that's a second attribute. See [Countdowns](https://plandalf.com/docs/promos/countdowns).

## Check it's working

1.  ### Open the published page
    
    Use a private window. In the browser console, type `plandalf`: you should see a function. `undefined` means the script isn't on the page.
    
2.  ### Click your button
    
    Plandalf opens the checkout over the page.
    
3.  ### Make a test purchase
    
    Open the **Test mode link** on the Share screen, or add your staging site in Plandalf under **Settings → Advanced → Test domains**. See [Test mode](https://plandalf.com/docs/get-started/test-mode).
    

## If it isn't working

-   The button does nothing: check that body code is enabled in the Integration tab and that you saved Theme Options.
-   Check the attribute name is exactly `data-plandalf-present` and that its value is your checkout's slug, not the full checkout link.
-   If a caching or speed plugin delays or combines scripts, exclude `plandalf-sdk.js` from it, then purge the cache.
-   Add `data-debug="true"` to the script tag and the console logs what the script is doing.

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

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