← back to Sister Parish Onboarding
importer: map global.width metafield (Carnegie-class fix)
22f4fcc6ffb98e7a134dd1eeccc3a404349c727f · 2026-08-31 10:53:27 -0700 · Steve
Files touched
M scripts/push_shopify.js
Diff
commit 22f4fcc6ffb98e7a134dd1eeccc3a404349c727f
Author: Steve <steve@designerwallcoverings.com>
Date: Mon Aug 31 10:53:27 2026 -0700
importer: map global.width metafield (Carnegie-class fix)
---
scripts/push_shopify.js | 14 ++++++++++++++
1 file changed, 14 insertions(+)
diff --git a/scripts/push_shopify.js b/scripts/push_shopify.js
index a755413..0984d6a 100644
--- a/scripts/push_shopify.js
+++ b/scripts/push_shopify.js
@@ -21,6 +21,17 @@ const BASE = `https://${SHOP}/admin/api/2026-01`;
const RATE_DELAY_MS = 350; // ~3 req/s, well under DW Plus 4 req/s
const data = JSON.parse(fs.readFileSync(path.join(__dirname,'..','output','normalized.json'),'utf8'));
+// TK-11024: width metafield (Carnegie-class). Width isn't in normalized.json; it lives in the
+// per-PDP crawl (pdp_specs.json → canon.width), keyed by sp_product_id (same source that fills
+// sisterparish_catalog.specs.width). Build a lookup; missing file → empty map (no-op).
+let widthBySpId = new Map();
+try {
+ const pdp = JSON.parse(fs.readFileSync(path.join(__dirname,'..','output','pdp_specs.json'),'utf8'));
+ for (const r of pdp) {
+ const w = r && r.canon && r.canon.width != null ? String(r.canon.width).trim() : '';
+ if (w) widthBySpId.set(String(r.sp_product_id), w);
+ }
+} catch { /* pdp_specs.json absent → no width metafield, same as today */ }
const ARGS = new Set(process.argv.slice(2));
const DRY = ARGS.has('--dry-run');
@@ -102,6 +113,9 @@ function buildProductPayload(p) {
{ namespace: 'dwc', key: 'source_url', type: 'single_line_text_field', value: p.url },
{ namespace: 'dwc', key: 'source_product_id', type: 'single_line_text_field', value: String(p.sp_product_id) },
{ namespace: 'dwc', key: 'pricing_rule', type: 'single_line_text_field', value: 'vendor_retail / 0.85' },
+ ...(widthBySpId.get(String(p.sp_product_id))
+ ? [{ namespace: 'global', key: 'width', type: 'single_line_text_field', value: widthBySpId.get(String(p.sp_product_id)) }]
+ : []),
]
}
};
← e058c64 chore: macstudio3 migration — reconcile from mac2 + repoint
·
back to Sister Parish Onboarding
·
guard TK-11357 Fix D: sister-parish push_shopify.js — don't 3e2c3fc →