← back to Designer Wallcoverings
enricher: also write CANONICAL search-by-color schema (custom.color_{1,2,3}_hex + _percentage + _name) that live Shop-by-Color + SearchByColorWheel actually read — was only writing custom.color_hex/color_details which the UI ignores. Re-pushing all 5,157 with designer names + canonical keys.
29127900b1eaa1d9876499066d8db6ab2e2dc8b8 · 2026-06-13 13:46:07 -0700 · Steve Abrams
Files touched
M DW-Programming/enrich-active-colors.js
Diff
commit 29127900b1eaa1d9876499066d8db6ab2e2dc8b8
Author: Steve Abrams <steve@designerwallcoverings.com>
Date: Sat Jun 13 13:46:07 2026 -0700
enricher: also write CANONICAL search-by-color schema (custom.color_{1,2,3}_hex + _percentage + _name) that live Shop-by-Color + SearchByColorWheel actually read — was only writing custom.color_hex/color_details which the UI ignores. Re-pushing all 5,157 with designer names + canonical keys.
---
DW-Programming/enrich-active-colors.js | 10 ++++++++++
1 file changed, 10 insertions(+)
diff --git a/DW-Programming/enrich-active-colors.js b/DW-Programming/enrich-active-colors.js
index bcd4f1f9..80a46850 100644
--- a/DW-Programming/enrich-active-colors.js
+++ b/DW-Programming/enrich-active-colors.js
@@ -43,9 +43,19 @@ async function writeMetafields(numericId, colorHex, aiColors) {
const mutation = `mutation($mf:[MetafieldsSetInput!]!){ metafieldsSet(metafields:$mf){ userErrors{ field message } } }`;
const owner = `gid://shopify/Product/${numericId}`;
const mf = [
+ // our richer keys (full breakdown + dominant)
{ ownerId: owner, namespace: 'custom', key: 'color_hex', type: 'single_line_text_field', value: colorHex },
{ ownerId: owner, namespace: 'custom', key: 'color_details', type: 'json', value: JSON.stringify(aiColors) },
];
+ // CANONICAL search-by-color schema (custom.color_{1,2,3}_hex + _percentage) — what
+ // the live Shop-by-Color / SearchByColorWheel reads. Top-3 dominant colors. (2026-06-13)
+ for (let i = 0; i < 3; i++) {
+ const c = aiColors[i];
+ if (!c) break;
+ mf.push({ ownerId: owner, namespace: 'custom', key: `color_${i+1}_hex`, type: 'single_line_text_field', value: c.hex });
+ mf.push({ ownerId: owner, namespace: 'custom', key: `color_${i+1}_percentage`, type: 'number_decimal', value: String(c.percentage) });
+ mf.push({ ownerId: owner, namespace: 'custom', key: `color_${i+1}_name`, type: 'single_line_text_field', value: c.name });
+ }
const r = await shopifyGraphQL(mutation, { mf });
const ue = r?.data?.metafieldsSet?.userErrors;
if (ue && ue.length) throw new Error(ue[0].message);
← 4c0fb021 local-palette: expand to ~115-name DESIGNER/decor color tabl
·
back to Designer Wallcoverings
·
backfill-canonical-colors.js — push canonical color_1/2/3 me 0e985f97 →