[object Object]

← back to Designer Wallcoverings

PDP color palette: shrink swatches to ~1/3 (84->28px) + link each color to storefront search for all published SKUs of that color (live theme 144076931123)

6dc6439c9fc53a9e0217423aaeeb2b1676fa7ad5 · 2026-07-08 10:25:26 -0700 · steve@designerwallcoverings.com

Files touched

Diff

commit 6dc6439c9fc53a9e0217423aaeeb2b1676fa7ad5
Author: steve@designerwallcoverings.com <steve@designerwallcoverings.com>
Date:   Wed Jul 8 10:25:26 2026 -0700

    PDP color palette: shrink swatches to ~1/3 (84->28px) + link each color to storefront search for all published SKUs of that color (live theme 144076931123)
---
 .../theme-LIVE-591/snippets/color-palette.liquid   | 38 ++++++++++++++--------
 1 file changed, 25 insertions(+), 13 deletions(-)

diff --git a/shopify/theme-LIVE-591/snippets/color-palette.liquid b/shopify/theme-LIVE-591/snippets/color-palette.liquid
index f4bee9f8..37f81db8 100644
--- a/shopify/theme-LIVE-591/snippets/color-palette.liquid
+++ b/shopify/theme-LIVE-591/snippets/color-palette.liquid
@@ -31,7 +31,7 @@
 <div class="dw-color-palette" data-dw-color-palette
   {% if color_details_raw != blank and color_details_raw != 'null' %}data-colors='{{ color_details_raw | escape }}'{% endif %}
   {% if primary_hex != blank %}data-primary-hex="{{ primary_hex }}"{% endif %}
-  {% if ai_colors_raw != blank and ai_colors_raw != 'null' %}data-ai-colors='{{ ai_colors_raw | escape }}'{% endif %}
+  {% if ai_colors_raw != blank and ai_colors_raw != 'null' %}data-ai-colors='{{ ai_colors_raw }}'{% endif %}
   {% if color_name != blank %}data-color-name="{{ color_name }}"{% endif %}
   {% if color_hex != blank %}data-color-hex="{{ color_hex }}"{% endif %}
   {% if product.featured_image %}data-product-image="{{ product.featured_image | img_url: '400x400' }}"{% endif %}
@@ -43,19 +43,21 @@
 <style>
   .dw-color-palette{padding:16px 0 10px;text-align:center;min-height:10px;}
   .dw-color-palette__title{font-family:Lora,serif;font-size:15px;font-weight:500;color:#3D4246;margin:0 0 12px;letter-spacing:-0.01em;}
-  .dw-color-palette__cards{display:flex;gap:14px;justify-content:center;flex-wrap:wrap;max-width:640px;margin:0 auto;}
-  .dw-color-palette__card{display:flex;flex-direction:column;align-items:center;gap:6px;text-decoration:none;width:88px;}
-  .dw-color-palette__swatch{width:84px;height:84px;border-radius:10px;border:2px solid #e5e2dc;box-shadow:0 1px 4px rgba(0,0,0,.06);transition:transform .15s ease,border-color .15s ease,box-shadow .15s ease;position:relative;overflow:hidden;}
-  .dw-color-palette__card:hover .dw-color-palette__swatch{transform:translateY(-2px);border-color:#3D4246;box-shadow:0 4px 12px rgba(0,0,0,.14);}
-  .dw-color-palette__name{font-family:Lora,serif;font-size:12px;color:#3D4246;line-height:1.2;max-width:88px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;text-transform:capitalize;}
-  .dw-color-palette__pct{font-size:12px;font-weight:600;color:#8a8577;letter-spacing:.02em;}
-  .dw-color-palette__bar{display:flex;height:6px;border-radius:4px;overflow:hidden;max-width:640px;margin:14px auto 0;box-shadow:inset 0 0 0 1px rgba(0,0,0,.04);}
+  /* swatches shrunk to ~1/3 (84px -> 28px), chrome scaled down to match (Steve 2026-07-08) */
+  .dw-color-palette__cards{display:flex;gap:8px;justify-content:center;flex-wrap:wrap;max-width:640px;margin:0 auto;}
+  .dw-color-palette__card{display:flex;flex-direction:column;align-items:center;gap:3px;text-decoration:none;width:auto;min-width:28px;max-width:66px;}
+  a.dw-color-palette__card{cursor:pointer;}
+  .dw-color-palette__swatch{width:28px;height:28px;border-radius:4px;border:1px solid #e5e2dc;box-shadow:0 1px 3px rgba(0,0,0,.06);transition:transform .15s ease,border-color .15s ease,box-shadow .15s ease;position:relative;overflow:hidden;}
+  .dw-color-palette__card:hover .dw-color-palette__swatch{transform:translateY(-1px);border-color:#3D4246;box-shadow:0 3px 8px rgba(0,0,0,.14);}
+  .dw-color-palette__name{font-family:Lora,serif;font-size:10px;color:#3D4246;line-height:1.2;max-width:64px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;text-transform:capitalize;}
+  .dw-color-palette__pct{font-size:10px;font-weight:600;color:#8a8577;letter-spacing:.02em;}
+  .dw-color-palette__bar{display:flex;height:4px;border-radius:3px;overflow:hidden;max-width:640px;margin:12px auto 0;box-shadow:inset 0 0 0 1px rgba(0,0,0,.04);}
   .dw-color-palette__bar span{display:block;height:100%;}
   .dw-color-palette:empty{display:none;}
   @media (max-width:600px){
-    .dw-color-palette__cards{gap:10px;}
-    .dw-color-palette__card{width:70px;}
-    .dw-color-palette__swatch{width:66px;height:66px;}
+    .dw-color-palette__cards{gap:6px;}
+    .dw-color-palette__card{max-width:56px;}
+    .dw-color-palette__swatch{width:22px;height:22px;}
   }
 </style>
 
@@ -98,9 +100,19 @@
       var hex = c.hex || N[(c.name||'').toLowerCase()] || '#ccc';
       var name = c.name || '';
       var pct = pctOf(c);
-      var card = document.createElement('div');
+      /* Link each color to ALL published ("pushed") SKUs of that color via the storefront
+         search — Shopify search only indexes published products, so "if pushed" is inherent.
+         No name -> not linkable, render a plain swatch. (Steve 2026-07-08) */
+      var card;
+      if(name){
+        card = document.createElement('a');
+        card.href = '/search?q=' + encodeURIComponent(name) + '&type=product';
+        card.title = 'View all ' + name + ' wallcoverings' + (pct!=null? ' — '+pct+'% here':'') + ' ('+hex+')';
+      } else {
+        card = document.createElement('div');
+        card.title = (pct!=null? pct+'% ':'') + '('+hex+')';
+      }
       card.className = 'dw-color-palette__card';
-      card.title = name + (pct!=null? ' — '+pct+'%':'') + ' ('+hex+')';
       var sw = document.createElement('div');
       sw.className = 'dw-color-palette__swatch';
       sw.style.background = hex;

← 7decbc76 Thibaut double-roll: automate — importer stamps min/step=2 a  ·  back to Designer Wallcoverings  ·  auto-save: 2026-07-08T10:35:15 (3 files) — pending-approval/ 14e4dd9e →