Swish Docs
Go to websiteInstall now
  • Swish Documentation
  • GETTING STARTED
    • Getting Started
  • THEME EXTENSIONS
    • App Settings
    • Collection Buttons
    • Floating Wishlist Link
    • Product Page Buttons
    • Wishlist Page
  • CUSTOMIZATIONS
    • Code Editor
    • Custom Wishlist Page
    • Instant Header Link
    • Custom Colour Swatches
    • Save for Later Button
    • Wishlist Notifications
  • INTEGRATIONS
    • Swish API
    • Klaviyo Integration
      • Klaviyo Integration Setup
      • Configuring Events In Swish
      • Testing Events
      • Setting Up Klaviyo Flows
        • Wishlist Welcome Flow
        • Wishlist Reminder Flow
        • Low In Stock Flow
        • Back In Stock Flow
        • Price Drop Flow
      • Configuring Email Content
        • Flows and Events
        • Inserting A Single Product Into An Email Template
        • Inserting Multiple Products Into An Email Template
    • Google Analytics
    • Meta Pixel
    • Maestra
Powered by GitBook
On this page
  • Update app settings
  • Setup a custom colour map
  1. CUSTOMIZATIONS

Custom Colour Swatches

Add custom colour swatches for your product options.

PreviousInstant Header LinkNextSave for Later Button

Last updated 5 months ago

Some stores render product variants as colour swatches instead of dropdowns. Since there is no standardised way to set this up in Shopify, this customisation needs to be adjusted to your specific setup.

Requires coding.

This customisation requires some light coding. If you are not a developer, please have us do this for you.

Update app settings

First we need to adjust the app settings so that product variants are rendered as swatches.

Open the theme editor and find the Wishlist Page embed. Update the product options setting to: Swatches. You can then further style the input settings in the main App Settings embed.

You should now see product options on the Wishlist page rendered as swatches with text values.

Setup a custom colour map

With Code Access we modify the Custom Product Cards to understand how an option name is mapped to a colour or image. The sample below assumes that you have uploaded png files in Shopify, which have the same name as your production option values. How exactly an option value is mapped to a colour or image will vary from store to store.

class WishlistProductCard extends WishlistElement {
  // Only replace the function below, not the entire file
  getColorMap(option) {
    if (option.name === "Color") {
      return option.values.reduce((colorMap, value) => {
        const handle = this.app.utils.url.handlelize(value);
        const color = handle.split("_").pop();
        const image = this.app.utils.url.getFileUrl(`${handle}.png`);

        return {
          ...colorMap,
          [handle]: { image, color },
        }
      }, {}); 
    }
  }
}
Screenshot 2023-08-24 at 16.59.24.png