Skip to content
Docs
Available on the Shopify App Store

Styling & Data Attributes

This is the shared reference for <dkl-discount-badge> — the data-* attributes that drive its behaviour and the --dkl-badge-* tokens that style it. The app block settings map onto these; on a web component you set them directly.

All optional — the carrier (or your own Liquid) supplies them. Set one to override.

"percentage" | "fixed" | "highest" · default: percentage

Which amount to show — the percent, the cents, or whichever saves more. highest is computed against the current variant price (percent × price vs the fixed cents); ties favour the percentage, and a missing side falls back to the other.

number (decimal percent) · default: carrier (max_reward_percent)

The percentage amount (rounded for display).

int (cents) · default: carrier (max_reward_cents)

The fixed amount (money-formatted).

int (cents) · default: carrier (the variant's price)

The variant price; drives the highest comparison (recomputed on variant change).

string · default: carrier (shop.money_format)

Money format for the fixed amount.

string · default: Save up to [amount]

Label template; [amount] is replaced with the formatted amount.

Image highlighting the CSS styling tokens for the DKL Discount Badge component

CSS styling tokens for the DKL Discount Badge component

The stylesheet (loaded site-wide by the embed) styles the host element directly — the host is the badge, so target dkl-discount-badge { … } (there are no CSS parts). Set any token above the element — :root, the embed’s Custom CSS, an inline style, or the block’s scoped rule.

default: var(--dkl-color-accent)

Badge background.

default: #ffffff

Badge text.

default: var(--dkl-radius)

Badge corners.

default: 0.175rem

Vertical padding.

default: 0.5rem

Horizontal padding.

default: 0.75rem

Badge text size.

default: 600

Badge text weight.

The DK: Discount Badge block exposes Background color, Text color, Corner radius, Vertical / Horizontal padding, Font size, and Font weight settings that feed the matching tokens via a scoped <style> rule.

Restyle a single badge inline
<dkl-discount-badge
style="
--dkl-badge-background: #111;
--dkl-badge-color: #fff;
--dkl-badge-radius: 999px;
--dkl-badge-font-size: 0.85rem;
--dkl-badge-font-weight: 700;
"
></dkl-discount-badge>
Style the host via :root tokens
:root {
--dkl-badge-background: #111;
--dkl-badge-color: #fff;
--dkl-badge-radius: 999px;
}
Target the host element directly
dkl-discount-badge {
letter-spacing: 0.02em;
text-transform: uppercase;
}