Skip to main content

Setting Up the Wishlist Add Button

Add the Mage wishlist add button to your product pages, and customize its appearance from the admin.

Written by Amelia Hanes

What the Wishlist Add Button is

The wishlist add button is a branded "Add to Wishlist" button you can drop onto product pages so shoppers can save items to their Mage wishlist. The label, colours, shape and size are all configurable, and it can also be shown as text only. When a product is already on the customer's wishlist, the button automatically switches to the "in wishlist" state.

There are two parts to setting it up:

  1. Customize how it looks in the Mage admin.

  2. Add it to your theme by placing a small snippet wherever you want the button to appear.


Before you start

Prerequisite

The Mage app embed must be enabled in your theme for the button to render. In your Shopify admin go to Online Store → Themes → Customize → App embeds and make sure Mage Loyalty is toggled on.


Customize the appearance

In your Mage Loyalty admin, go to Wishlist and click Customise on Wishlist Add Button (it is also under Loyalty Pages). The builder opens full screen, with your settings on the left and a live preview of the button on a sample product page on the right.

Use the bar at the top of the builder to switch the preview between Not in wishlist and In wishlist (clicking the button in the preview does the same), and between desktop and mobile. You can zoom and move the preview, and undo or redo any change.

Content tab

  • Add to wishlist text: the label before the product is on the wishlist (default: Add to Wishlist).

  • In wishlist text: the label once the product is on the wishlist (default: In Wishlist).

  • Show heart icon: adds a heart before the text. It uses the text colour and fills in once the product is saved.

Design tab

  • Type: Button (slightly rounded corners), Pill (fully rounded) or Text only (the label and icon with no button around them).

  • Size: Small or Large padding.

  • Width: Standard (fits the text) or Full width (fills the space your theme gives it).

  • Font size: the text size (10 to 24 px).

  • Background, border and text colours: on hover the background and border shift lighter or darker on their own; the text colour stays the same.

  • Reset to defaults: puts the design settings back to their defaults. Your custom CSS is kept.

Text only

With Text only there is no button shape, so Size, Width, Background and Border are hidden. They keep their values, so switching back to Button or Pill restores them. The text and icon fade slightly on hover. If your text colour was the default white, it changes to black so it stays readable on your page.

Advanced tab

  • Disable customizer styles: skips the colours and font size from the Design tab, so the button's look comes entirely from your custom CSS.

  • Custom CSS: your own rules using the .mage-wishlist-add-button classes and --mage-wishlist-button-* variables. See the reference table below.

  • Add to your theme: the snippet, ready to copy.

Click Save when you're done. Changes apply to every button on your storefront immediately.

Ask Mage

On plans that include Mage AI, the builder has an Ask Mage button in the top bar. Describe the change you want in plain words, for example "match my store's Add to cart button" or "make it an outline button", and Ask Mage updates the settings or the custom CSS for you. Changes show in the preview straight away and stay unsaved until you click Save, and you can undo them.

Ask Mage can also suggest where the snippet could go in your theme. It reads your live theme to make the suggestion, but themes differ and are often customised, so treat it as a starting point and check it on a copy of your theme first.


Add Button Setup

To make the button appear on your storefront, add this snippet in any product template, section or block with access to the product object, such as beside Add to cart or below the price.

<mage-wishlist-add-button product-id="{{ product.id }}"></mage-wishlist-add-button>

Tip

When placed on a product page, the button automatically adapts to the customer's currently selected variant if the product has variants available.

There are two ways to add it to your theme.


Option 1: Add via the Theme Customizer (no code)

This is the easiest option if your theme supports adding blocks to product pages.

  1. Go to Online Store → Themes → Customize.

  2. Open a product page in the customizer.

  3. Click Add block inside the product information area and choose Custom Liquid.

  4. Paste the snippet above into the Custom Liquid box.

  5. Drag the block to where you want the button to appear (e.g. below the price or next to Add to cart) and click Save.

Note

Not every theme exposes a Custom Liquid block in the product information area. If you can't find one, use Option 2 below.


Option 2: Add by editing the theme code

Use this option if your theme doesn't support a Custom Liquid block in the right place, or you want full control over where the button sits.

  1. Duplicate your theme first. Go to Online Store → Themes, click the ⋯ menu next to your live theme and choose Duplicate. Make your changes on the copy so you can preview them safely.

  2. On the copy, click ⋯ then Edit code.

  3. Open the main product section (commonly sections/main-product.liquid, or the buy buttons snippet it uses, such as snippets/buy-buttons.liquid).

  4. Paste the snippet above where you want the button to appear.

  5. Click Save, preview the copy, then publish it.

Not sure where it goes?

Every theme is built differently. If you're unsure, or would rather not edit your theme, the Mage team can add it for you. Email [email protected].


CSS classes & variables reference

If you're using the custom CSS field (or styling from your theme stylesheet), these are the targets the button exposes. The variables are written by the Design tab's settings; to set them yourself in custom CSS, turn on Disable customizer styles first.

Selector / Variable

What it targets

.mage-wishlist-add-button

The button itself.

.mage-wishlist-add-button--active

The button when the product is on the wishlist.

.mage-wishlist-add-button--button, --pill, --text

The Type setting: Button, Pill or Text only.

.mage-wishlist-add-button--small, --large

The Size setting.

.mage-wishlist-add-button--width-full

The Full width setting.

.mage-wishlist-add-button__label

The button text.

.mage-wishlist-add-button__icon

The heart icon (when Show heart icon is on).

--mage-wishlist-button-bg

Background colour.

--mage-wishlist-button-border

Border colour.

--mage-wishlist-button-text

Text and icon colour.

--mage-wishlist-button-hover-bg, --mage-wishlist-button-hover-border

Background and border on hover.

--mage-wishlist-button-font-size

Text size.

Changing the background in CSS?

Add a :hover rule with the same background and border too. The built-in hover style is more specific than a plain rule on the button, so without it the button switches back to the Design tab's shade on hover.


Still need help? Email [email protected] or reach out to the Mage Loyalty team through our live chat support.

Did this answer your question?