[object Object]

← back to Designer Wallcoverings

Activate 9 repaired Versace articles: verified AS-Creation images + specs + double-roll, live on Shopify

bd69dbc20ef726cedcedafb661dcc430245b0c0c · 2026-07-14 10:33:22 -0700 · Steve

Files touched

Diff

commit bd69dbc20ef726cedcedafb661dcc430245b0c0c
Author: Steve <steve@designerwallcoverings.com>
Date:   Tue Jul 14 10:33:22 2026 -0700

    Activate 9 repaired Versace articles: verified AS-Creation images + specs + double-roll, live on Shopify
---
 DW-Programming/activate-versace-nan.js | 75 ++++++++++++++++++++++++++++++++++
 1 file changed, 75 insertions(+)

diff --git a/DW-Programming/activate-versace-nan.js b/DW-Programming/activate-versace-nan.js
new file mode 100644
index 00000000..8d024159
--- /dev/null
+++ b/DW-Programming/activate-versace-nan.js
@@ -0,0 +1,75 @@
+#!/usr/bin/env node
+/**
+ * Finish + ACTIVATE the 9 repaired Versace articles (Steve-authorized 2026-07-14).
+ * They already have image + width(27") + length(33') + description + order_min=2.
+ * This completes the double-roll config (packaged + units=2) to match the DWVS line,
+ * then flips status DRAFT -> ACTIVE. Titles keep the compliant mfr-number fallback.
+ *
+ * Usage: node activate-versace-nan.js [--live]
+ */
+require('dotenv').config({ path: require('os').homedir() + '/Projects/secrets-manager/.env' });
+const { Client } = require('pg');
+const LIVE = process.argv.includes('--live');
+const STORE = 'designer-laboratory-sandbox.myshopify.com';
+const API = '2024-01';
+const TOKEN = process.env.SHOPIFY_ADMIN_TOKEN;
+const DB = process.env.DATABASE_URL || 'postgresql://dw_admin@127.0.0.1:5432/dw_unified';
+const sleep = ms => new Promise(r => setTimeout(r, ms));
+
+const TARGETS = {
+  '366924':'7821709475891','370507':'7821709508659','370551':'7821709541427',
+  '791333':'7821709606963','791351':'7821709672499','791352':'7821709705267',
+  '791361':'7821709738035','791755':'7821709770803','935834':'7821709803571',
+};
+
+async function gql(query, variables) {
+  const res = await fetch(`https://${STORE}/admin/api/${API}/graphql.json`, {
+    method: 'POST',
+    headers: { 'X-Shopify-Access-Token': TOKEN, 'Content-Type': 'application/json' },
+    body: JSON.stringify({ query, variables }),
+  });
+  const j = await res.json(); if (j.errors) throw new Error(JSON.stringify(j.errors).slice(0,160));
+  return j.data;
+}
+async function rest(method, path, body) {
+  const r = await fetch(`https://${STORE}/admin/api/${API}/${path}`, {
+    method, headers: { 'X-Shopify-Access-Token': TOKEN, 'Content-Type': 'application/json' },
+    body: body ? JSON.stringify(body) : undefined });
+  if (!r.ok) throw new Error(`${r.status}: ${(await r.text()).slice(0,140)}`);
+  return r.json();
+}
+
+async function main() {
+  const client = new Client(DB); await client.connect();
+  const entries = Object.entries(TARGETS);
+  console.log(`Mode: ${LIVE ? '🔴 LIVE' : '🟡 DRY RUN'} | ${entries.length} Versace articles → complete double-roll + ACTIVATE`);
+  if (!LIVE) { entries.forEach(([m])=>console.log(`  ${m}: set packaged+units=2, status ACTIVE`)); console.log('Re-run with --live.'); await client.end(); return; }
+  let ok=0, err=0;
+  for (const [mfr, pid] of entries) {
+    const gid = `gid://shopify/Product/${pid}`;
+    try {
+      // 1) finish double-roll config
+      const d = await gql(`mutation($mf:[MetafieldsSetInput!]!){ metafieldsSet(metafields:$mf){ userErrors{ message } } }`,
+        { mf: [
+          { ownerId: gid, namespace:'global', key:'packaged', type:'single_line_text_field', value:'Packaged in Double Rolls' },
+          { ownerId: gid, namespace:'global', key:'v_prods_quantity_order_units', type:'single_line_text_field', value:'2' },
+        ]});
+      if (d.metafieldsSet.userErrors.length) throw new Error(JSON.stringify(d.metafieldsSet.userErrors));
+      // 2) activate
+      await rest('PUT', `products/${pid}.json`, { product: { id: Number(pid), status: 'active' } });
+      // 3) mirror
+      await client.query(`
+        UPDATE shopify_products SET status='ACTIVE', metafields =
+          coalesce(metafields,'{}'::jsonb) || jsonb_build_object('global',
+            coalesce(metafields->'global','{}'::jsonb) || jsonb_build_object(
+              'packaged', jsonb_build_object('type','string','value','Packaged in Double Rolls'),
+              'v_prods_quantity_order_units', jsonb_build_object('type','string','value','2')))
+        WHERE shopify_id = $1`, [ gid ]);
+      ok++; console.log(`  ✓ ${mfr} ACTIVE (double-roll)`);
+      await sleep(500);
+    } catch(e) { err++; console.log(`  ✗ ${mfr}: ${String(e.message).slice(0,140)}`); }
+  }
+  await client.end();
+  console.log(`\n=== DONE === activated ${ok}, errors ${err} | Cost $0`);
+}
+main().catch(e => { console.error(e); process.exit(1); });

← f9f91dd1 auto-save: 2026-07-14T10:30:32 (5 files) — DW-Programming/Im  ·  back to Designer Wallcoverings  ·  auto-save: 2026-07-14T11:00:40 (6 files) — DW-Programming/Im 5a132743 →