[object Object]

← back to Designer Wallcoverings

fix: align hasDesc threshold with bodyHtmlValid (> 0 not >= 5) to prevent stale has_description=false on short descriptions

b466ef20a10a6de744399d6c695570c2a104eebb · 2026-08-25 04:08:54 -0700 · steve@designerwallcoverings.com

Files touched

Diff

commit b466ef20a10a6de744399d6c695570c2a104eebb
Author: steve@designerwallcoverings.com <steve@designerwallcoverings.com>
Date:   Tue Aug 25 04:08:54 2026 -0700

    fix: align hasDesc threshold with bodyHtmlValid (> 0 not >= 5) to prevent stale has_description=false on short descriptions
---
 shopify/scripts/sync-shopify-products.js | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/shopify/scripts/sync-shopify-products.js b/shopify/scripts/sync-shopify-products.js
index bdd85785..a5864b2f 100644
--- a/shopify/scripts/sync-shopify-products.js
+++ b/shopify/scripts/sync-shopify-products.js
@@ -393,7 +393,10 @@ async function syncProducts(quickMode = false) {
       const prices = variants.map(v => (v.price == null ? null : parseFloat(v.price))).filter(p => p != null);
       const minPrice = prices.length ? Math.min(...prices) : null;
       const bodyHtml = product.descriptionHtml || '';
-      const hasDesc = bodyHtml.replace(/<[^>]*>/g, '').trim().length >= 5;
+      // threshold aligned with bodyHtmlValid() in carnegie-mfr-gate.mjs (> 0, not >= 5)
+      // using >= 5 caused 1-4 char descriptions to sync as has_description=false even when
+      // the importer (correctly) set the product active via bodyHtmlValid().
+      const hasDesc = bodyHtml.replace(/<[^>]*>/g, '').replace(/&[a-z#0-9]+;/gi, '').trim().length > 0;
       const variantCount = variants.length;
       // Product-level identity SKU = the SELLABLE (non-sample) variant, computed ONCE.
       // Bug (fixed 2026-08-20): the loop upserts one row per variant with `sku = EXCLUDED.sku`,

← 69e75649 auto-data-snapshot: 2026-08-25T03:23:00 (2 data files) — DW-  ·  back to Designer Wallcoverings  ·  dw-free-samples: add block-nonpurchasable-checkout validatio 67cd4ff9 →