Skip to main content
A web component is the <dkl-price> tag written directly into your theme’s Liquid. On a product page it needs zero attributes — it clones a pre-staged carrier and renders the primary product’s price server-side.

Usage

On a product page, add the <dkl-price> web component — it renders the primary product’s price server-side:

Pairing with the volume picker

To let <dkl-price> own the price display, set the volume picker’s price target to none (data-price-target="none") and hide the theme’s native price. The picker then only emits tier-change events, and <dkl-price> is the single element that updates.

Beta Limitation for Web Components: Single Product Context

During beta of the DKL Live Components, a web component is only recommended for product pages / where the products shown on the page are static on page load.For use on a page where new product instances are loaded in via the Section Rendering API / Ajax (such as a paginated collection page for example) we recommend using the app block instead. See App blocks vs. Web Components.

Reacting to changes

<dkl-price> emits a discount-kit-live:price:change event whenever its displayed price updates — the recommended hook for running your own code when the price moves. It carries the previous and new price (see the Events reference). See Listen for price changes below. Two narrower alternatives:
  • Listen for the tier event — the volume picker’s discount-kit-live:volume-discount:tier-change, e.g. to read the selected tier’s quantity. See Listen for tier changes.
  • Watch the discounted state — if you only care about whether this element is showing a discount, observe its data-dkl-discounted attribute (set while a tier is active) with a MutationObserver:

Examples

For the full list of data-* attributes you can set, see Styling & Data Attributes.
Override attributes + tokens
Listen for price changes
Listen for tier changes

Next steps

Styling & Data Attributes

Every data-* attribute, --dkl-* token, and CSS part.

App block

The no-code, theme-editor placement.