Events
<dkl-volume-picker-radio-groups> is the source of the tier-change event in Discount Kit
Live. It has no direct reference to <dkl-price> — instead
it emits a tier-change event that the price (and any of your own code) can listen for,
coupled by event name and product id only.
discount-kit-live:volume-discount:tier-change
Section titled “discount-kit-live:volume-discount:tier-change”CustomEvent
Fired when a tier is selected or deselected. Bubbles, so you can listen on document.
The detail carries resource:
{ productId, variantId, widgetId, widgetType, previousTier: VolumeDiscountTier | null, currentTier: VolumeDiscountTier | null, // null = deselected updatesPrice: boolean // see below}// VolumeDiscountTier: { index, quantity, discountAmount, discountType, unitPriceCents }A full example payload:
// event.detail.resource on tier-change{ productId: 7820000000001, variantId: 41200000000001, widgetId: 'a1b2c3d4', // the app block's id (null on a web component) widgetType: 'volume-picker-radio-groups', previousTier: null, currentTier: { index: 1, quantity: 3, discountAmount: 10, // percent for 'percentage', major-unit amount for 'fixedAmount' discountType: 'percentage', unitPriceCents: 1800 // the per-item discounted price }, updatesPrice: true // false → <dkl-price> ignores the tier for pricing}Lifecycle
Section titled “Lifecycle”Each Volume Picker instance also emits mount and unmount events as its behaviour
attaches and tears down — handy for wiring up (and cleaning up) custom integrations per
instance. Both bubble and carry the same DklWidgetEventDetail resource.
discount-kit-live:widget:mount
Section titled “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
Section titled “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.
// event.detail.resource on widget:mount / widget:unmount{ widgetType: 'volume-picker-radio-groups', widgetId: 'a1b2c3d4', // the app block's id (null on a web component) productId: 7820000000001, variantId: 41200000000001}