Skip to main content
<dkl-price> is event-driven. It has no direct reference to the volume picker — instead it listens for the picker’s tier-change event and the theme’s variant-change events, and updates the price accordingly.

Listens for

discount-kit-live:volume-discount:tier-change
CustomEvent
Emitted by the volume picker. Matched by product id — a selected tier shows the discounted price, a null tier reverts to base. Coupling is by event name and product id only, with no import between the two components.Honours the event’s updatesPrice flag: if the picker’s “Update price when a tier is selected” setting is off, <dkl-price> ignores the tier for pricing (the event still fires for other listeners).
It also reacts to the host theme’s variant-change events: on a variant change it updates the base price and re-applies the active tier, recomputing the discount off the new variant’s price (sale-priced variants included).

Emits

<dkl-price> emits a price-change event whenever its displayed price updates, plus mount / unmount lifecycle events. All bubble, so you can listen on document.
widgetId and variantId. widgetId is the app block’s id — it’s null on a web component, variantId is the current variant and updates as the shopper switches variants (not just the variant at page load).

Price change

discount-kit-live:price:change
CustomEvent
Fired whenever the displayed price changes — when a volume tier is selected or deselected, or the variant changes. Not fired on initial mount (the server-rendered price is already in the DOM), and deduped — a recompute that lands on the same price (e.g. switching to an equally-priced variant) doesn’t fire. The detail carries resource with the previous and new price, mirroring the tier event’s previousTier / currentTier:
A full example payload — selecting a tier that moves the price from £20.00 to £18.00:

Lifecycle

The mount / unmount events fire as the instance’s behaviour attaches and tears down — handy for wiring up (and cleaning up) custom integrations per instance. Both carry a DklWidgetEventDetail resource.
discount-kit-live:widget:mount
CustomEvent
Fired once the controller has attached its behaviour to the (already server-rendered) element. resource: { widgetType, widgetId, productId?, variantId? }productId and variantId are included when known.
discount-kit-live:widget:unmount
CustomEvent
Fired when the instance tears down — e.g. the element is removed, or the theme editor re-renders the section. Same resource shape. Use it to detach any listeners or observers you set up on mount.

Next steps

Web Components

Listener and MutationObserver examples for reacting to changes.

Volume Picker

The component that emits the tier-change event.