[object Object]

← back to Mdc Onboard

mdc-onboard: emit specs as metafields, not a body_html <table> (stops the PR More-Specs defect at the source)

5cbeec3bd423c6f3a2e22cd30910cf85124932be · 2026-07-29 07:02:12 -0700 · Steve Abrams

Files touched

Diff

commit 5cbeec3bd423c6f3a2e22cd30910cf85124932be
Author: Steve Abrams <steve@designerwallcoverings.com>
Date:   Wed Jul 29 07:02:12 2026 -0700

    mdc-onboard: emit specs as metafields, not a body_html <table> (stops the PR More-Specs defect at the source)
---
 import-drafts.py | 34 +++++++++++++++++++++-------------
 1 file changed, 21 insertions(+), 13 deletions(-)

diff --git a/import-drafts.py b/import-drafts.py
index 7ba8f60..df5cf6e 100644
--- a/import-drafts.py
+++ b/import-drafts.py
@@ -91,19 +91,10 @@ def build_body(r):
     intro = (f'<p>{pat} from the Phillipe Romano {coll} collection &mdash; a '
              f'high-performance Type II commercial wallcovering. Priced per single roll; '
              f'request a memo sample to see the material in hand, or contact us for a quote.</p>')
-    table = '<table>' + ''.join([
-        spec_row('Pattern', pat),
-        spec_row('Color', r['color_name']),
-        spec_row('Material', r['material']),
-        spec_row('Width', r['width']),
-        spec_row('Backing', r['backing']),
-        spec_row('Weight', r['weight']),
-        spec_row('Fire Rating', r['fire_rating']),
-        spec_row('Pattern Match', r['pattern_match']),
-        spec_row('Certifications', r['certifications']),
-        spec_row('Manufacturer SKU', r['mfr_sku']),
-    ]) + '</table>'
-    return intro + table
+    # Specs now live in METAFIELDS (theme "More specifications"), not a body <table>.
+    # (Fixed 2026-07-29: the description-table was blanking More-Specs and had to be
+    #  re-migrated to metafields across the whole PR line — build it right at the source.)
+    return intro
 
 
 def build_payload(r):
@@ -127,6 +118,23 @@ def build_payload(r):
         mfs.append({'namespace': 'custom', 'key': 'real_color_name', 'type': 'single_line_text_field', 'value': color})
     if r['width'] and r['width'].strip():
         mfs.append({'namespace': 'global', 'key': 'width', 'type': 'single_line_text_field', 'value': r['width'].strip()})
+    if pat:
+        mfs.append({'namespace': 'custom', 'key': 'pattern_name', 'type': 'single_line_text_field', 'value': pat})
+    # Spec metafields the theme's "More specifications" reads (types verified 2026-07-29):
+    #   material = multi_line; the rest single_line; weight -> product_weight (NOT custom.weight,
+    #   which is a Shopify weight-type field); pattern_match -> custom.match_type.
+    _specs = [
+        ('material',       'custom', 'material',       'multi_line_text_field'),
+        ('backing',        'custom', 'backing',        'single_line_text_field'),
+        ('weight',         'custom', 'product_weight', 'single_line_text_field'),
+        ('fire_rating',    'custom', 'fire_rating',    'single_line_text_field'),
+        ('pattern_match',  'custom', 'match_type',     'single_line_text_field'),
+        ('certifications', 'custom', 'certifications', 'single_line_text_field'),
+    ]
+    for _col, _ns, _key, _typ in _specs:
+        _v = r.get(_col)
+        if _v and str(_v).strip():
+            mfs.append({'namespace': _ns, 'key': _key, 'type': _typ, 'value': str(_v).strip()})
     return {'product': {
         'title': title,
         'body_html': build_body(r),

← 0ce21d8 Dublin: drop 'Vital' name per Steve — rename pattern->Dublin  ·  back to Mdc Onboard  ·  auto-save: 2026-07-29T07:06:42 (1 files) — __pycache__/impor 1693b9f →