Web components
Seven custom elements: save button, counts, wishlist, share controls and shared list.
JavaScript API
The
window.loveful bus: saved state, events, clearing and sharing.CSS variables
Every
--loveful-* custom property, with its default.Webhooks
Signed wishlist events posted to your own URLs.
How the pieces fit
- The app embed is required. It’s the only thing that loads Loveful on the storefront. Blocks, the snippet and your own markup all do nothing while it’s off.
- Nothing is fetched on page load. A signed-in shopper’s saved items come from their customer metafields, printed by the embed. A guest’s are kept in their browser and move to their account when they sign in.
- Every element follows one state. A save anywhere updates every button, count and list on the page, and in the shopper’s other tabs.
- Liquid can read the same data. The signed-in customer’s saved variants (
refs_1) and each product’s and variant’s saved count (saved_count) are readable under the app’s metafield namespace,app--<id>. Copy it from yourloveful-wishlistsnippet (Settings > Storefront fills it in).
Quick start
1
Turn on the app embed
In the theme editor, open App embeds and switch on Loveful. Check with
window.loveful in the browser console on any storefront page.2
Create the loveful-wishlist snippet
In Loveful, go to Settings > Storefront and copy the snippet under Product cards and header. In the theme’s Edit code, add a snippet named
loveful-wishlist, paste and save. It holds your store’s metafield namespace, and renders card hearts and a header link.3
Drop in an element
Put a save button anywhere on a product template:
4
Listen for saves
Guides
Hearts on your product cards
The snippet’s heart, or your own markup.
Header wishlist link
A link with a live count of saved items.
React to saves
Toasts, theme badges and analytics from wishlist events.
Restyle with CSS variables
Match Loveful’s elements to your theme.
What you can’t do from the theme
- Save or remove from script. The bus has no add or remove method: saves go through a
<loveful-button>the shopper clicks, and removes through it or a wishlist card’s remove control.clear()empties a whole list. - Render Loveful’s own snippets.
loveful-cardandloveful-iconbelong to the app’s blocks, and Shopify doesn’t let a theme render them. Write your own card markup for<loveful-list>. - Read other shoppers’ lists. Only the signed-in shopper’s own list, and lists shared by link, are available on the storefront. For everything else, use webhooks.