[object Object]

← back to Gmc Titlefix

weight override: tiered feed weights — real 1lb / samples 0.35lb (Steve 2026-07-09)

e01bb10408f968bdacc734847cd3f8c832ef1aff · 2026-07-09 08:47:46 -0700 · steve

Files touched

Diff

commit e01bb10408f968bdacc734847cd3f8c832ef1aff
Author: steve <steve@designerwallcoverings.com>
Date:   Thu Jul 9 08:47:46 2026 -0700

    weight override: tiered feed weights — real 1lb / samples 0.35lb (Steve 2026-07-09)
---
 gmc-weight-override.js | 12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)

diff --git a/gmc-weight-override.js b/gmc-weight-override.js
index 2e0e74f..fbb2803 100644
--- a/gmc-weight-override.js
+++ b/gmc-weight-override.js
@@ -16,7 +16,9 @@ const { token, MERCHANT } = require('./_auth.js');
 const fs = require('fs');
 const CACHE = '/Users/macstudio3/Projects/gmc-viewer/data/catalog.json';
 const OUT = '/Users/macstudio3/.claude/yolo-queue/gmc-weight-override-list.json';
-const WEIGHT_LB = parseFloat(process.env.WEIGHT_LB || '1');
+// Tiered feed weights (Steve 2026-07-09): real products 1 lb, $4.25 samples 0.35 lb.
+const WEIGHT_REAL = parseFloat(process.env.WEIGHT_REAL || '1');
+const WEIGHT_SAMPLE = parseFloat(process.env.WEIGHT_SAMPLE || '0.35');
 const args = process.argv.slice(2);
 const INCLUDE_SAMPLES = args.includes('--include-samples');
 const CREATE_DS = args.includes('--create-ds');
@@ -32,10 +34,10 @@ function buildList() {
     const needsWeight = (i.issues || []).includes('missing_shipping_weight');
     const isSample = Math.abs(i.price - 4.25) < 0.01;
     if (needsWeight || (INCLUDE_SAMPLES && isSample)) {
-      targets.push({ offerId: i.offerId, contentLanguage: (i.id || '').split(':')[1] || 'en', feedLabel: i.country || 'US', reason: needsWeight ? 'missing_shipping_weight' : 'sample-preemptive', title: i.title });
+      targets.push({ offerId: i.offerId, contentLanguage: (i.id || '').split(':')[1] || 'en', feedLabel: i.country || 'US', weight: isSample ? WEIGHT_SAMPLE : WEIGHT_REAL, reason: needsWeight ? 'missing_shipping_weight' : 'sample-preemptive', title: i.title });
     }
   }
-  return { generated_at: new Date().toISOString(), weight_lb: WEIGHT_LB, include_samples: INCLUDE_SAMPLES, count: targets.length, targets };
+  return { generated_at: new Date().toISOString(), weight_real_lb: WEIGHT_REAL, weight_sample_lb: WEIGHT_SAMPLE, include_samples: INCLUDE_SAMPLES, count: targets.length, targets };
 }
 
 async function createDataSource() {
@@ -59,7 +61,7 @@ async function apply(ds) {
     if (Date.now() - tokAt > 50 * 60 * 1000) { tok = await token(); tokAt = Date.now(); }
     const row = slice[i];
     const url = `https://merchantapi.googleapis.com/products/v1/accounts/${MERCHANT}/productInputs:insert?dataSource=${encodeURIComponent(ds)}`;
-    const body = { offerId: row.offerId, contentLanguage: row.contentLanguage, feedLabel: row.feedLabel, productAttributes: { shipping: [], shippingWeight: { value: WEIGHT_LB, unit: 'lb' } } };
+    const body = { offerId: row.offerId, contentLanguage: row.contentLanguage, feedLabel: row.feedLabel, productAttributes: { shipping: [], shippingWeight: { value: row.weight, unit: 'lb' } } };
     const r = await fetch(url, { method: 'POST', headers: { Authorization: 'Bearer ' + tok, 'Content-Type': 'application/json' }, body: JSON.stringify(body) });
     if (r.ok) ok++; else { fail++; if (fail <= 10) console.error('FAIL', row.offerId, r.status, (await r.text()).slice(0, 160)); }
     if (i % 500 === 0) console.log(`  ${i}/${slice.length} | ok ${ok} fail ${fail}`);
@@ -74,7 +76,7 @@ async function apply(ds) {
   const out = buildList();
   fs.writeFileSync(OUT, JSON.stringify(out, null, 2));
   const byReason = out.targets.reduce((a, t) => (a[t.reason] = (a[t.reason] || 0) + 1, a), {});
-  console.log(`Shipping-weight override targets: ${out.count} @ ${WEIGHT_LB}lb (feed-only, checkout unaffected)`);
+  console.log(`Shipping-weight override targets: ${out.count} (real ${WEIGHT_REAL}lb / samples ${WEIGHT_SAMPLE}lb — feed-only, checkout unaffected)`);
   console.log('  by reason:', JSON.stringify(byReason));
   console.log(`Wrote ${OUT}`);
   out.targets.slice(0, 6).forEach(t => console.log(`  ${t.offerId}  ${t.reason}  ${(t.title || '').slice(0, 40)}`));

← 0cd0040 add gmc price-override + shipping-weight-override generators  ·  back to Gmc Titlefix  ·  weight-override FIX-FIRST (contrarian): +verify-link/list-ds 766c063 →