← back to Designerwallcoverings
TK-11076: sanitize commas in color: tag (Shopify splits tags on comma) — keep metafield verbatim
98f971f1ddc139a413d4c5f38652cc2489491011 · 2026-09-01 17:27:00 -0700 · Steve Abrams
Files touched
M scripts/colorway-title-anchor/tk11076-colorway-retag.mjs
Diff
commit 98f971f1ddc139a413d4c5f38652cc2489491011
Author: Steve Abrams <steve@designerwallcoverings.com>
Date: Tue Sep 1 17:27:00 2026 -0700
TK-11076: sanitize commas in color: tag (Shopify splits tags on comma) — keep metafield verbatim
---
scripts/colorway-title-anchor/tk11076-colorway-retag.mjs | 13 ++++++++-----
1 file changed, 8 insertions(+), 5 deletions(-)
diff --git a/scripts/colorway-title-anchor/tk11076-colorway-retag.mjs b/scripts/colorway-title-anchor/tk11076-colorway-retag.mjs
index b2d9bb3..7796320 100644
--- a/scripts/colorway-title-anchor/tk11076-colorway-retag.mjs
+++ b/scripts/colorway-title-anchor/tk11076-colorway-retag.mjs
@@ -137,8 +137,11 @@ function planProduct(p) {
if (parsed.skip) {
return { skip: { handle: p.handle, vendor: p.vendor, title: p.title, reason: parsed.reason, form: parsed.form } };
}
- const colorway = parsed.colorway; // real mfr colorway, verbatim (title case)
- const facet = 'color:' + colorway;
+ const colorway = parsed.colorway; // real mfr colorway, verbatim (title case) — for the METAFIELD
+ // Shopify TAGS split on commas, so a multi-color colorway ("Black, Yellow, Red") would explode into
+ // stray tags. Sanitize commas -> " / " for the tag ONLY (the metafield keeps the verbatim comma form).
+ const facetVal = colorway.replace(/\s*,\s*/g, ' / ');
+ const facet = 'color:' + facetVal;
// THIS product's OWN AI palette (source-field driven, per-product).
const palette = new Set();
@@ -167,7 +170,7 @@ function planProduct(p) {
return { plan: {
id: p.id, handle: p.handle, status: p.status, vendor: p.vendor, title: p.title,
- colorway, form: parsed.form, oldTags, newTags, strippedFacet, strippedPalette,
+ colorway, facetVal, form: parsed.form, oldTags, newTags, strippedFacet, strippedPalette,
oldColorwayMeta: oldCw, newColorwayMeta: colorway,
} };
}
@@ -180,7 +183,7 @@ function diffRow(pl) {
handle: pl.handle, vendor: pl.vendor, title: pl.title, form: pl.form,
old_color_related_tags: oldColorRelated,
parsed_colorway: pl.colorway,
- new_color_tag: 'color:' + pl.colorway,
+ new_color_tag: 'color:' + (pl.facetVal || pl.colorway),
old_metafield_real_color_name: pl.oldColorwayMeta || '(empty)',
new_metafield_real_color_name: pl.newColorwayMeta,
palette_strays_stripped: pl.strippedPalette,
@@ -283,7 +286,7 @@ async function run() {
const v = await gql(`query($id:ID!){ product(id:$id){ tags m:metafield(namespace:"${CW_META_NS}",key:"${CW_META_KEY}"){ value } } }`, { id: pl.id });
const lt = (v && v.product && v.product.tags) || [];
- const facetOk = lt.some(t => norm(t) === norm('color:' + pl.colorway));
+ const facetOk = lt.some(t => norm(t) === norm('color:' + (pl.facetVal || pl.colorway)));
const metaOk = norm((v && v.product && v.product.m && v.product.m.value) || '') === norm(pl.colorway);
const ok = facetOk && metaOk;
ok ? pass++ : (fail++, console.error(` VERIFY FAIL ${pl.handle}: facetOk=${facetOk} metaOk=${metaOk}`));
← 0d054c4 TK-11070: hero-fix tool — re-upload correct per-colorway her
·
back to Designerwallcoverings
·
chore: v0.1.9 (session close — sanderson daily-batch payload 8339f05 →