Skip to content

Instantly share code, notes, and snippets.

View thevrus's full-sized avatar
🌎
Work from Earth

Vadim Rusin thevrus

🌎
Work from Earth
View GitHub Profile
@thevrus
thevrus / wishlist.md
Created July 6, 2024 15:28 — forked from panoply/wishlist.md
Client Slide Wishlist for Shopify

Usage

The function invokes as an IIFE and is exposed in global scope (i.e, window.wishlist or simply, wishlist). This means that you simply drop it in via <script>. It provides several methods for usage. By default, it will not do anything until you wire it up. Firstly, let me explain the main methods:

// use render method to optionally create a virtual wishlist, more on this later
wishlist.render((product) => `<a href="#"><img class="img" src="${product.img}"></a>`);

// If you need to listen for wishes
wishlist.on('wished', (args) =&gt; console.log(args));