Skip to main content
Three ways to put a wishlist link with a count in the header, from least to most code. All of them update the moment the shopper saves or removes something, in any tab.

Option 1: the snippet

With the loveful-wishlist snippet created, render it in the header file (header.liquid in most themes), next to the cart icon:
sections/header.liquid
string
required
count
string
Where the link goes. Defaults to the wishlist page the snippet was copied with.
It renders a link with a heart drawn in CSS and a <loveful-count> badge, counted in Liquid for the signed-in shopper so it’s right on first paint:
The badge is hidden while the list is empty and shows 99+ above 99. It takes the header’s text colour, with the number in the opposite colour. Restyle it with:
The snippet’s aria-label starts as the English “Wishlist”. Once the page loads, Loveful sets it from the loveful.header_label translation, so it’s read aloud in the shopper’s language. Change the wording on Settings › Translations.

Option 2: loveful-header-icon

A ready-made heart and badge, with no snippet needed. Wrap it in a link:
Leave the element empty: Loveful fills it with the icon and a <loveful-count>, and labels it with the loveful.header_label translation unless it already has an aria-label. Its size and colours are --loveful-icon-size, --loveful-icon-color, --loveful-count-bg and --loveful-count-fg. See <loveful-header-icon>.

Option 3: the theme’s own icon

To match the theme’s other header icons exactly, use its own icon markup and add a <loveful-count>:
sections/header.liquid
Replace app--1234567 with the namespace in your loveful-wishlist snippet. Here the theme’s bubble wraps the count, so hide the bubble too when the count hides:
<loveful-count> sets hidden and data-count on itself; see <loveful-count> for data-cap and data-hide-at-zero.

A count anywhere else

The same element works in a mobile menu, a drawer or the wishlist page’s heading:
To drive your own badge from script instead, read window.loveful.state.size on the bus’s item_added, item_removed and list_cleared events. See React to saves.