Skip to main content
A heart on each product card lets shoppers save from collections, search results and anywhere else the theme shows cards. App blocks can’t go inside a product card, so the heart comes from the loveful-wishlist snippet, which you create once in the theme’s code.

1. Create the snippet

Loveful can’t write theme files, so the snippet is pasted by hand:
  1. In Loveful, go to Settings > Storefront and click Copy snippet under Product cards and header.
  2. In the theme’s Edit code, add a snippet named loveful-wishlist, paste and save.
The copy already has your store’s metafield namespace and wishlist page filled in. Settings > Storefront shows Added once Loveful finds it in the live theme.

2. Render it in the card

Find the theme’s product card snippet (card-product.liquid in Dawn and most Shopify themes) and render the heart inside the element that wraps the card’s image:
snippets/card-product.liquid
string
required
heart
product
required
The card’s product: whatever variable the card snippet uses for it (card_product in Dawn).
The heart is positioned absolutely over the image’s top right corner, so the element that contains it needs position: relative. Most themes already set it on the card’s media wrapper for their own badges.

What it renders

A <loveful-button> in card heart mode:
  • It saves the product’s selected or first available variant.
  • It shows as saved when any variant of the product is saved, and a click on a saved heart removes every saved variant of the product.
  • Its click doesn’t open the card’s link.
  • aria-pressed and data-saved are worked out in Liquid from the signed-in customer’s saved items, so the heart is right on first paint. A guest’s hearts fill in once the script runs.
  • The heart is drawn in CSS, not in the markup, so its look can change without re-pasting the snippet.
Cards added later, by a filter, infinite scroll or a quick view, work with no extra code.

Position, size and colour

The merchant sets these in the theme editor under App embeds > Loveful > Product card heart (see Save button): position (top right, top left or in line), size, colour, colour when saved, and the white circle behind it. In CSS, set the card heart variables:
To move it, override the position on the element:

Writing the markup yourself

Write the element directly when the snippet’s markup doesn’t suit the card, for example to save a particular variant or to put the heart beside the title instead of over the image:
Without the snippet’s saved check, a signed-in shopper’s heart shows as unsaved until the script runs. Every attribute is on <loveful-button>.

Snippet versions

Every element the snippet renders carries data-loveful-snippet="<version>"; the current version is 1. Settings > Storefront shows Update needed when the theme’s copy is older: copy the snippet again and paste it over the old one. The render lines in the theme don’t change.