Use <ooo-wl-wishlist-count> to show the number of items in the current customer’s wishlist. The component fetches the count and refreshes it after successful wishlist add and remove events.
Before using it, install Wishlist Power and enable its app embed in Online Store → Themes → Customize → App embeds.
Basic example
Place the component inside your wishlist link. Give the link a positioned container if you want an overlaid badge.
<a class="wishlist-link" href="/pages/wishlist" aria-label="Open wishlist">
<span aria-hidden="true">♡</span>
<ooo-wl-wishlist-count hidden block-start="0px" inline-end="0px"></ooo-wl-wishlist-count>
</a>
Replace the link destination with your store’s actual wishlist page URL. The initial hidden attribute prevents an empty badge from flashing while the count loads. The component updates it after fetching the count.
.wishlist-link { position: relative; }
ooo-wl-wishlist-count[hidden] { display: none; }
Input attributes
| Attribute | Example | Behavior |
|---|---|---|
block-start |
"0px" |
Sets --ooo-wl-count-badge-block-start on the component for your CSS positioning. |
inline-end |
"0px" |
Sets --ooo-wl-count-badge-inline-end on the component. |
show-zero |
"true" |
Shows the badge with 0 when the wishlist is empty. By default, the empty badge is hidden. |
hide-count |
"true" |
Keeps the badge visible for a nonzero count but visually hides its number with the sr-only class. |
hidden |
No value | Useful in initial markup; the component sets or removes it according to the count and show-zero. |
For show-zero and hide-count, use the literal value "true" to enable the option. A bare attribute or "false" does not enable it. For a dot instead of a numbered badge, set hide-count="true"; the badge remains hidden when the count is zero unless show-zero="true" is also set.
The component writes the current number to its count attribute and creates or updates an inner <span>. Style the badge in your theme’s CSS; the positioning attributes set CSS variables but do not position your badge by themselves.
ooo-wl-wishlist-count {
position: absolute;
inset-block-start: var(--ooo-wl-count-badge-block-start, 0);
inset-inline-end: var(--ooo-wl-count-badge-inline-end, 0);
}
If the component sits inside <ooo-wl-access-button>, that parent also receives has-wishlist-items when the count is above zero.
The count is fetched when the component initializes if the current visitor can access a wishlist, and it refreshes after ooo-wishlist:product-added and ooo-wishlist:product-removed. No separate theme JavaScript is required. If your store requires login for wishlists, test the badge with a signed-in customer.
For a theme walkthrough, see Add a wishlist counter to your theme. For the control that changes wishlist membership, see <ooo-wl-wishlist-button>.