Hype Discounts

Cart progress bar element

Updated Sep 18, 20263 min read

On this page (8)

<hype-tiered-cart-progress-bar> renders a Cart Goals campaign: a collapsible header, a progress bar with one dot per goal, the success messages for goals already reached, and any free gifts those goals unlock. It reads the cart from the SDK, so it re-renders whenever the cart changes.

This is a Hype Discounts campaign block. It is not part of Hype Cart Drawer, even though it usually sits next to the cart.

Placement

The theme editor block is Hype: Progress Bar, and it can go in any section — a header group, a cart section, a sidebar. In custom code, place the tag wherever you want it and pass the campaign's App block ID:

<hype-tiered-cart-progress-bar  id="hype-progress"  identifier="YOUR_APP_BLOCK_ID"  {% if request.design_mode %}design-mode="true"{% endif %}></hype-tiered-cart-progress-bar>

The element renders nothing when the campaign is inactive or has no goals.

Attributes

AttributeRequiredDefaultDescription
identifierYes""The campaign block's App block ID
design-modeNofalsetrue renders placeholder goals for styling in the theme editor
is-openNotrueWhether the body is expanded. Reflected: it flips when the shopper clicks the header, so you can style the open and closed states.

is-open treats only the exact string "false" as closed. Any other value, including an empty attribute, means open.

What controls the content

The wording, the icons, the goals and their gifts all come from the block's settings in the Hype admin, not from attributes. Two settings change the structure you are styling:

  • Show icon decides whether each progress dot renders an icon above its label.
  • Show offers decides when gifts appear: Current goal shows a goal's gifts only once that goal is unlocked, Next goal shows them regardless, and Hide goal hides that goal's gifts entirely.

CSS custom properties

PropertyDefaultApplies to
--font-size14pxHeader and gift text. Dot labels and success messages are 2px smaller.
--font-weightboldHeader and gift titles
--header-bg-color#000Header background, the filled part of the progress bar, and unlocked dots
--header-text-color#fffHeader text and the icon inside an unlocked dot
--body-bg-color#F7F7F7Expanded body background
--body-text-color#000Gift titles, subtitles and descriptions
--product-bg-color#fff from the theme blockBackground of each gift row
--max-width100%Outer width
--border-radius10pxHeader and body corners

--header-bg-color does more than the name suggests: change it and the progress fill and the unlocked dots change with it. The unfilled track and locked dots are a fixed #ccc.

Parts

PartElement
progress-wrapperOuter container
progress-headerClickable header
header-contentIcon and message inside the header
header-iconHeader icon, when the block sets one
arrow-iconExpand/collapse chevron
progress-bodyCollapsible body
progress-bar-containerWrapper around the bar
progress-barThe track
progress-bar-fillThe filled portion
progress-dotOne goal marker
progress-dot-iconIcon inside a marker
progress-dot-labelLabel under a marker
progress-success-messagesContainer for reached-goal messages
success-messageOne reached-goal message
gifts-blockWrapper around one goal's gifts
gift-items-containerThe list of gift rows
tier-gift-containerThe <hype-free-gift-item> itself

These parts are forwarded out of each gift row:

PartElement
tier-gift-itemGift row
tier-gift-imageImage container
tier-gift-detailsText column
tier-gift-statusSubtitle line
tier-gift-titleProduct title
tier-gift-descriptionDescription line
tier-claim-buttonClaim button
tier-free-labelBadge over the image

The gift banner forwards the same row under banner- names, and it does not forward a description part. The two prefixes exist so a page carrying both elements can style them separately.

Gift state

Each gift row reflects its state, so no JavaScript is needed to style claimed or locked gifts:

#hype-progress hype-free-gift-item[is-added-to-cart] { opacity: 0.6; }#hype-progress hype-free-gift-item[is-disabled] { filter: grayscale(100%); }

is-disabled means the goal is not reached yet, or a claim is in flight. is-loading marks the gift whose claim request is running.

Styling example

<style>  #hype-progress {    --header-bg-color: #14532d;    --header-text-color: #f0fdf4;    --body-bg-color: #ffffff;    --product-bg-color: #f8fafc;    --border-radius: 6px;    --font-size: 15px;    --max-width: 480px;  }  #hype-progress::part(progress-header) {    text-transform: uppercase;    letter-spacing: 0.06em;  }  #hype-progress::part(progress-bar) {    height: 8px;  }  #hype-progress::part(progress-dot-label) {    font-weight: 600;  }  #hype-progress::part(tier-claim-button) {    border-radius: 999px;    padding: 8px 16px;  }</style>

Related articles

Still stuck?

Ask a follow-up and we'll see it came from “Cart progress bar element”.

Opens chat with your question and a link to this article.