2.0 Beta

Smootify 2.0 is in public beta. Your 1.x store keeps working. Move when you want.

What changed

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.

v2.0 betaAdd-on: Wishlist
Open .md
On this page
  1. How it fits together
  2. 1. Add the toggle
  3. 2. Build the wishlist page
  4. 3. Show the count
  5. 4. Share the list
  6. Before you publish

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. 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-toggle goes inside a smootify-product: on the product page or in a product card. A click saves the product, a second click removes it.
  • smootify-product with data-id="wishlist", or smootify-variant with data-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-share shares 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 the element wishlist-toggle inside smootify-product. Put what the visitor clicks inside it, such as a heart icon or a button. The whole toggle is the click area.

<wishlist-toggle><button type="button">Save</button></wishlist-toggle>

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 in the component’s CSS, for example to fill the heart. The two states:

StateWhat changes
A product not savedthe toggle has no class
A product savedthe toggle has the class is-in-wishlist; a button inside it gets is-active and screen readers hear it as pressed

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 for the grid, and inside it a smootify-product with the 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. Only the first smootify-product with data-id="wishlist" on the page is used.

<div condition="has-items-in-wishlist">
  <div>
    <smootify-product data-id="wishlist">
      <div product="title">Product</div>
      <smootify-price><div data-prop="price">$0.00</div></smootify-price>
      <wishlist-toggle><button type="button">Remove</button></wishlist-toggle>
    </smootify-product>
  </div>
</div>
<div condition="no-items-in-wishlist">Your wishlist is empty</div>

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 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:

smootify-product data-id="wishlist"

Only the product template

A saved product
Its product card.
A saved variant
The card of its product, with that variant selected.
smootify-variant data-product-id="wishlist"

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.
smootify-product data-id="wishlist"smootify-variant data-product-id="wishlist"

Both templates

A saved product
A card of the product template.
A saved variant
A card of the variant template.
<div>
  <smootify-variant data-product-id="wishlist">
    <div product="title">Product</div>
    <div variant="title">Blue / M</div>
    <smootify-price><div data-prop="price">$0.00</div></smootify-price>
    <wishlist-toggle><button type="button">Remove</button></wishlist-toggle>
  </smootify-variant>
</div>

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-wishlist shows.
Classes
has-wishlist on the body, is-wishlist-item on each card.

An empty wishlist

Condition
no-items-in-wishlist shows.

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.

<a href="/wishlist"><div>Wishlist</div><div wishlist="count">0</div></a>

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.

  1. Add the element wishlist-share, with a button inside, anywhere: on the wishlist page, in the navbar or in the account.
  2. Give it the attribute data-page with the path of your wishlist page, such as /wishlist. Without it, the link opens the page it is on.
<wishlist-share data-page="/wishlist" data-title="My wishlist">
  <button>Share my list</button>
</wishlist-share>

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 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.

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-page on wishlist-share to the page that has one.

    ↑ ↓ to moveEnter to openEsc to close