[object Object]

← back to Hollywood Import

hollywood-add-yard: guard against $0-orderable yard variant (TK-11357 class)

d995321a2db3de7e66e40c062cb410d7bb87686d · 2026-09-15 01:22:21 -0700 · Steve Abrams

Refuse to bulk-create + inventory-stamp a Sold Per Yard variant when it.hw is
null/0/undefined; a $0 variant with inventoryPolicy CONTINUE stamped on_hand=2026
becomes checkout-orderable for $0.00. Skip loudly in dry-run and apply.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

Files touched

Diff

commit d995321a2db3de7e66e40c062cb410d7bb87686d
Author: Steve Abrams <steve@designerwallcoverings.com>
Date:   Tue Sep 15 01:22:21 2026 -0700

    hollywood-add-yard: guard against $0-orderable yard variant (TK-11357 class)
    
    Refuse to bulk-create + inventory-stamp a Sold Per Yard variant when it.hw is
    null/0/undefined; a $0 variant with inventoryPolicy CONTINUE stamped on_hand=2026
    becomes checkout-orderable for $0.00. Skip loudly in dry-run and apply.
    
    Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
---
 hollywood-add-yard.mjs | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/hollywood-add-yard.mjs b/hollywood-add-yard.mjs
index 9418e3c..45f6e5f 100644
--- a/hollywood-add-yard.mjs
+++ b/hollywood-add-yard.mjs
@@ -47,6 +47,16 @@ console.log(`add-yard: ${todo.length} of 812 · ${APPLY ? 'APPLY' : 'DRY-RUN'}`)
 let added = 0, healed = 0, skip = 0, err = 0;
 for (const it of todo) {
   const gid = `gid://shopify/Product/${it.pid}`;
+  // $0-ORDERABLE GUARD (TK-11357 class): refuse to create/stamp a "Sold Per Yard" variant when
+  // the per-yard price it.hw is missing/0 — a $0 variant created with inventoryPolicy CONTINUE and
+  // then stamped on_hand=2026 becomes checkout-orderable for $0.00. Skip loudly in BOTH dry-run and
+  // apply; never bulk-create (L58), never inventory-stamp (L74).
+  if (!(Number.isFinite(Number(it.hw)) && Number(it.hw) > 0)) {
+    skip++;
+    if (out) out.write(JSON.stringify({ pid: it.pid, dw: it.dw, action: 'SKIP_ZERO_PRICE', hw: it.hw }) + '\n');
+    console.log(`  ⛔ ${it.dw}: SKIP zero/blank per-yard price (hw=${it.hw}) — would create a $0 orderable variant`);
+    continue;
+  }
   if (!APPLY) { console.log(`  ${it.dw}: would add "Sold Per Yard" @ $${it.hw} (sku ${it.dw}-Yard); sample ${it.dw}-Sample stays $4.25`); continue; }
   try {
     const d = await gql(LOOKUP, { id: gid }); if (d.__cap) { out.write(JSON.stringify({ pid: it.pid, action: 'CAP_ABORT', added }) + '\n'); out.end(); console.log(`\nCAP-ABORT: added=${added} this run. Exit 3.`); process.exit(3); }

← d248f23 TK-11757: price>0 guard on RESUME path of danapoint-promote  ·  back to Hollywood Import  ·  hollywood-create: guard against creating+publishing a $0-ord c571527 →