Install code attributes
Every attribute the checkout's script tag reads, with examples for embed and overlay.
The install code is one script tag from your store's address,
https://yourstore.fungies.io/element/v2/loader.js (or your own domain, once it is active). The tag
reads everything it needs from its own attributes. Copy it from the Checkout page in the
dashboard; this page explains what each attribute does if you want to change it.
Attributes
| Attribute | Required | What it does |
|---|---|---|
data-checkout | Yes | The element's id, shown on the Checkout page with a Copy button |
data-mode | No | overlay opens a dialog from your button. Leave it out to embed |
data-target | No | Embed only: a CSS selector for the container. Defaults to #fungies-checkout |
data-opener | Overlay | Overlay only: a CSS selector for the button that opens the checkout |
data-locale | No | The checkout's language: en, de or pl. Anything else falls back to en |
data-appearance | No | light or dark fixes the palette; auto, the default, follows the buyer's device |
data-offer | No | Sell only this one offer of the element |
data-quantity | No | The starting quantity, a whole number above 0. The buyer can still change it |
data-discount | No | A discount code to start the checkout with. The buyer sees it and can change or remove it |
The script tag must be a plain <script src> tag in your HTML. Loaded through a dynamic import it
cannot find its own attributes and draws nothing.
If something is wrong, the checkout is not drawn and the browser console shows a line starting
with [fungies-element] that says why, for example
no element on the page matches #fungies-checkout.
Embed
<div id="fungies-checkout-1"></div>
<script
src="https://yourstore.fungies.io/element/v2/loader.js"
data-checkout="2f5d0b4e-9a1c-4c7a-b0d3-1c9f6a2e7b41"
data-target="#fungies-checkout-1"
></script>The checkout grows with its content, so the container needs no fixed height. Whether it scrolls inside its own box instead, its maximum width and its inner padding are set on the element in the Frontends builder.
Overlay
<button type="button" id="fungies-buy-1" disabled>Buy now</button>
<script
src="https://yourstore.fungies.io/element/v2/loader.js"
data-checkout="2f5d0b4e-9a1c-4c7a-b0d3-1c9f6a2e7b41"
data-mode="overlay"
data-opener="#fungies-buy-1"
></script>The button starts disabled and the script enables it once the checkout has loaded, so an early
click does nothing rather than failing. Each button needs its own script tag. Style the button
however you like: the script adds no styles to your page.
The dialog takes the whole screen below 768px wide. Esc always closes it. Whether a click outside closes it, whether it shows a close button and how wide it is are set on the element in the Frontends builder.
One offer, a quantity and a discount code
<div id="fungies-checkout-1"></div>
<script
src="https://yourstore.fungies.io/element/v2/loader.js"
data-checkout="2f5d0b4e-9a1c-4c7a-b0d3-1c9f6a2e7b41"
data-target="#fungies-checkout-1"
data-offer="7d0f3c8a-2f4e-4b8e-9a51-0c6f1e2d3b4a"
data-quantity="2"
data-discount="SPRING10"
></script>data-offermust be one of the offers the element sells. Any other offer is refused, and the checkout is not drawn.data-quantityapplies to the one offer the checkout sells: thedata-offerone, or the element's only offer. On an element with several offers and nodata-offerit is refused. The number must be within what the offer allows; an offer with a fixed quantity takes only1.data-discountis checked when the price is calculated. An unknown or expired code is shown to the buyer as such; the checkout goes on without it.
Several checkouts on one page
Give each its own container or button id and its own script tag. The Checkout page numbers
the ids for you (fungies-checkout-1, fungies-checkout-2), so codes copied for different
elements do not clash.
Last updated