Wishlist
A button that saves products for later, a wishlist page, a counter and a link to share the list, kept in the visitor's browser and, for logged-in customers, in their account.
A wishlist lets visitors save products, or single variants, to buy later. Smootify gives you four parts: a toggle that saves or removes an item, a list of the saved items for a wishlist page, a counter for the navbar, and a button that shares the list with a link. Each part works on its own, so you use only the ones your design needs.
Note
Turn on Wishlist in the Smootify dashboard. It is free on every plan. On your .webflow.io address it works for testing before you turn it on; on your own domain, wishlist-toggle and wishlist-share do nothing until it is on. Only turning it on adds the customer metafield Wishlist Data (custom.wishlist_data) to Shopify, where the list of a logged-in customer is saved. In Shopify, under Settings > Custom data > Customers, check that this definition has Customer accounts access set to Read and write: Smootify creates it that way, but a definition that already existed keeps its own setting.
How it fits together
wishlist-togglegoes inside asmootify-product: on the product page or in a product card. A click saves the product, a second click removes it.smootify-productwithdata-id="wishlist", orsmootify-variantwithdata-product-id="wishlist", is the card template of the wishlist page. Smootify repeats it once per saved item.wishlist="count"shows how many items are saved, anywhere on the page.wishlist-shareshares a link to the wishlist page with the saved items, anywhere on the page.
Where the list is kept. It depends on whether the visitor is logged in with customer accounts:
A visitor
- Kept in
- Their browser.
- Another device
- Does not have the list.
A logged-in customer
- Kept in
- Their browser and their account: the metafield
custom.wishlist_data. - Another device
- Has the same list.
When a customer logs in
- Kept
- The list that changed last, in the browser or in the account.
- Merged
- Never.
1. Add the toggle
Add a Custom element with the tag wishlist-toggle inside smootify-product. Put what the visitor clicks inside it, such as a heart icon or a Custom element with the tag button. The whole toggle is the click area.
Outside a smootify-product, the toggle is removed. The cards of the wishlist page are the exception: see below.
Show the state. Style the toggle’s class as a combo class, for example to fill the heart. To animate it, put a Webflow Rive element inside the toggle: Smootify plays its animations by name, from the toggle’s data-animation-on and data-animation-off custom attributes. The two states:
A product not saved
- Toggle
- No class.
- Rive
- On removal, plays the animation in
data-animation-off, oroff.
A product saved
- Toggle
- Gets
is-in-wishlist. Abuttoninside getsis-active, and screen readers hear it as pressed. - Rive
- Plays the animation in
data-animation-on, oron.
Save the variant. With data-use-variants on the toggle, the click saves the selected variant instead of the product, such as the hoodie in Blue / M. Saved variants count in wishlist="count" and show on the wishlist page, like saved products.
2. Build the wishlist page
On a page of its own, add a Div block for the grid, and inside it a smootify-product with the custom attribute data-id="wishlist". Design it as one product card: Smootify copies it once per saved product, and the copies go next to it, in the same Div block. Only the first smootify-product with data-id="wishlist" on the page is used.
Inside the card, everything a product card can show works: see Product cards. The cards follow the order in which the items were saved. A wishlist-toggle in a card removes the item that card shows, product or variant, and the card goes away.
Cards for the saved variants. To show saved variants as variant cards, add a smootify-variant with the custom attribute data-product-id="wishlist" and design it like a variant card. Smootify copies it once per saved variant, and only the first one on the page is used. You can use one template or both, and nothing saved is left out:
Only the product template
- A saved product
- Its product card.
- A saved variant
- The card of its product, with that variant selected.
Only the variant template
- A saved product
- The card of its first variant that can be bought, or of its first variant.
- A saved variant
- Its variant card.
Both templates
- A saved product
- A card of the product template.
- A saved variant
- A card of the variant template.
Here the toggle works inside the variant card too, without a smootify-product around it.
Empty or not. Two conditions work anywhere on the page, for these two states:
A wishlist with items
- Condition
has-items-in-wishlistshows.- Classes
has-wishliston the body,is-wishlist-itemon each card.
An empty wishlist
- Condition
no-items-in-wishlistshows.
3. Show the count
Add wishlist="count" to a text element, anywhere on the page, such as next to a wishlist link in the navbar. It shows the number of saved items and updates on each click.
What you type is a placeholder until the list is read. The full list of parts is in wishlist-toggle, wishlist-share, the wishlist cards and wishlist attributes.
4. Share the list
wishlist-share sends a friend, a partner or a colleague a link to the wishlist page with the visitor’s saved items, for gift ideas or a choice to approve. Whoever opens the link needs no account.
- Add a Custom element with the tag
wishlist-share, with a Custom element with the tagbuttoninside, anywhere: on the wishlist page, in the navbar or in the account. - Give it the custom attribute
data-pagewith the path of your wishlist page, such as/wishlist. Without it, the link opens the page it is on.
A click opens the device’s share sheet, on phones, or copies the link. With data-copy it always copies the link. data-title is the title of the share, by default the page’s title. Style the moments with combo classes: is-copied or is-shared for two seconds after the click, and is-empty, with its button disabled, while the list is empty.
The shared page. The link opens your wishlist page with the shared items in place of the visitor’s own, with the same card templates and wishlist="count". The visitor’s own list is not touched: on a shared list, the toggles in the cards save to the visitor’s own wishlist, “add it to mine too”. Two conditions tell the two lists apart in the design:
condition="shared-wishlist"shows an element only on a shared list, for a heading such as “A list for you”;condition="own-wishlist"shows it only on the visitor’s own list, for the share button itself.
The link is a snapshot: it holds the items saved when it was shared, up to 100. Items saved later need a new link, and products that are no longer sold in the visitor’s market do not show.
Coming from 1.x
data-use-variantsnow saves the variant. In 1.x the attribute did nothing and the toggle always saved the product. Remove it to keep the 1.x behaviour.- The events have new names. Scripts that listen to the wishlist should use
smootify:wishlist:changed_productand the othersmootify:wishlist:…names. The 1.x namessmootify_wishlist:…are still sent until 3.0. See Events.
Before you publish
Check these first
- The toggle disappears. It is not inside a
smootify-product, or, on the wishlist page, inside a card of a wishlist template. - Nothing happens on the live site. Wishlist is not turned on in the Smootify dashboard.
- The list does not follow the customer to another device. The customer is not logged in with customer accounts, or the Wishlist Data metafield does not have Read and write customer accounts access in Shopify.
- After logging in, the list is different. The browser list and the account list are not merged: the one changed last is kept.
- The shared link shows the visitor’s own list. The page it opens has no wishlist card template. Set
data-pageonwishlist-shareto the page that has one.