[object Object]

← back to Designer Wallcoverings

Guard GRS grasscloth width to 36" in command54 push (never inherit upstream vinyl 52/54")

ec3bf17e063f22d4f2fa4742cdd81ee0ce703f83 · 2026-07-06 17:31:25 -0700 · Steve

Files touched

Diff

commit ec3bf17e063f22d4f2fa4742cdd81ee0ce703f83
Author: Steve <steve@designerwallcoverings.com>
Date:   Mon Jul 6 17:31:25 2026 -0700

    Guard GRS grasscloth width to 36" in command54 push (never inherit upstream vinyl 52/54")
---
 DW-Programming/command54-shopify-push.js | 23 ++++++++++++++++++++---
 1 file changed, 20 insertions(+), 3 deletions(-)

diff --git a/DW-Programming/command54-shopify-push.js b/DW-Programming/command54-shopify-push.js
index 64375a03..8e468bc8 100644
--- a/DW-Programming/command54-shopify-push.js
+++ b/DW-Programming/command54-shopify-push.js
@@ -220,6 +220,22 @@ function buildTags(row) {
   return tagArray.join(', ');
 }
 
+// GRS = grasscloth = 36" ONLY (Steve hard rule). A grasscloth SKU must NEVER
+// inherit an upstream *vinyl* width (e.g. Command54's blanket 52/54"). Detect
+// grasscloth by DW/base SKU prefix or natural-fiber material, and force 36".
+const GRASSCLOTH_WIDTH = '36" Wide (trim to 34")';
+const GRASSCLOTH_RE = /\b(grass\s?cloth|sisal|abaca|jute|raffia|sea\s?grass|arrowroot|hemp)\b/i;
+function isGrasscloth(row) {
+  const sku = (row.dw_sku || row.base_sku || row.sku || '').toString();
+  if (/^GRS[-\s]/i.test(sku)) return true;
+  const hay = [row.material, row.composition, row.product_type, row.pattern_name, row.collection]
+    .filter(Boolean).join(' ');
+  return GRASSCLOTH_RE.test(hay);
+}
+function resolveWidth(row) {
+  return isGrasscloth(row) ? GRASSCLOTH_WIDTH : row.width;
+}
+
 function buildMetafields(row) {
   const mf = [];
   const add = (ns, key, val, type) => {
@@ -228,8 +244,9 @@ function buildMetafields(row) {
     }
   };
 
-  // Core specs
-  add('global', 'width', row.width);
+  // Core specs — width is GRS-guarded (grasscloth is 36", never upstream vinyl 52/54")
+  const resolvedWidth = resolveWidth(row);
+  add('global', 'width', resolvedWidth);
   add('global', 'repeat', row.pattern_repeat);
   add('global', 'Brand', VENDOR_DISPLAY);
   add('global', 'Collection', COLLECTION_NAME);
@@ -249,7 +266,7 @@ function buildMetafields(row) {
   if (styles.length > 0) add('global', 'Style', styles[0]);
 
   // Custom namespace
-  add('custom', 'width', row.width);
+  add('custom', 'width', resolvedWidth);
   add('custom', 'fire_rating', row.fire_rating || DEFAULT_FIRE_RATING);
   add('custom', 'material', row.composition, 'multi_line_text_field');
   add('custom', 'pattern_name', stripContact(row.pattern_name));

← d183fe68 Normalize all 1422 GRS grasscloth widths to 36" (kill 52/54"  ·  back to Designer Wallcoverings  ·  Mark command54-shopify-push.js RETIRED (dormant, kept for re 3ca302f9 →