Use the wishlist with the Boost search app
If you use the Boost search app, add the code below to Boost's files in your theme. The wishlist button then shows on the image of each product that Boost lists.
Before you start: duplicate your theme first (Online Store › Themes › … › Duplicate), so you can go back if something looks wrong.
Add the script
-
In your Shopify admin, go to Online Store › Themes, click … next to your current theme, then Edit code.
-
In the assets folder, open
boost-sd-custom.js. -
Paste this code into the file and click Save:
const customize = { customizeProductItem: (componentRegistry) => { componentRegistry.useComponentPlugin('ProductItem', { name: 'Modify Wishlist', enabled: true, apply: () => ({ afterRender(element){ let data = element?.getParams()?.props?.product; let availableVariants = data.variants.filter(function(e) { return e.available; }) let firstAvailableVariants = typeof availableVariants[0] !== 'undefined' ? availableVariants[0] : data.variants[0]; const wishlistHtml = document.createElement('div'); wishlistHtml.classList.add('wishlist-engine'); wishlistHtml.setAttribute('data-product_id', data.id); wishlistHtml.setAttribute('data-variant_id', firstAvailableVariants.id); wishlistHtml.setAttribute('data-full_button', 'false'); let productItem = document.querySelector('[data-product-id="'+ data.id +'"]'); productItem.querySelector('.boost-sd__product-image-wrapper').appendChild(wishlistHtml); } }), }); } } window.__BoostCustomization__ = (window.__BoostCustomization__ ?? []).concat([customize.customizeProductItem]);
Add the styles
This code places the button in the top right corner of the product image.
-
In the assets folder, open
boost-sd-custom.css. -
Paste this code into the file and click Save:
.boost-sd__product-list .wishlist-engine { display: block !important; position: absolute; z-index: 3; top: 5px; right: 5px; }
Check that it works: open a page of your store where Boost lists products. Each product image shows the wishlist button.
Need a hand? If you can't set it up, email support@scriptengine.net and our team will help you set everything up.