← back to Rebel Walls Push
align metafield types to store defs; canary 5 verified clean in Shopify
f6de29653a7b0bf627f702b92bbc93b4fe45ac27 · 2026-06-04 00:14:36 -0700 · Steve
Files touched
Diff
commit f6de29653a7b0bf627f702b92bbc93b4fe45ac27
Author: Steve <steve@designerwallcoverings.com>
Date: Thu Jun 4 00:14:36 2026 -0700
align metafield types to store defs; canary 5 verified clean in Shopify
---
scripts/push.js | 34 ++++++++++++++++++++++------------
1 file changed, 22 insertions(+), 12 deletions(-)
diff --git a/scripts/push.js b/scripts/push.js
index 0ecd088..ce40a5b 100644
--- a/scripts/push.js
+++ b/scripts/push.js
@@ -180,23 +180,33 @@ function buildTags(row) {
return tags;
}
+// Types aligned to the store's EXISTING metafield definitions (verified 2026-06-04).
+// global.* and custom.{manufacturer_sku,color,fire_rating} = single_line_text_field;
+// custom.material = multi_line_text_field; dwc.color = single_line_text_field.
+// Undefined keys (grammage/display_dimension/etc.) are kept in the body HTML, not as metafields.
function buildMetafields(row) {
const mf = [];
- const push = (ns, key, value, type = 'single_line_text_field') => {
+ const SL = 'single_line_text_field', ML = 'multi_line_text_field';
+ const push = (ns, key, value, type) => {
if (value == null || value === '') return;
mf.push({ namespace: ns, key, type, value: String(value) });
};
- push('custom', 'manufacturer_sku', row.mfr_sku);
- push('dwc', 'manufacturer_sku', row.mfr_sku);
- push('global', 'Brand', VENDOR, 'string');
- push('global', 'width', row.roll_width);
- push('global', 'unit_of_measure', row.price_unit || 'Priced Per Square Meter', 'string');
- if (row.color_name) { push('custom', 'color', row.color_name); push('custom', 'real_color_name', row.color_name); push('global','color',row.color_name); }
- push('custom', 'fire_rating', row.fire_rating);
- push('custom', 'grammage', row.grammage);
- push('custom', 'material', row.material);
- push('custom', 'display_dimension', row.display_dimension);
- if (row.product_url) push('custom', 'source_url', row.product_url, 'url');
+ push('custom', 'manufacturer_sku', row.mfr_sku, SL);
+ push('global', 'manufacturer_sku', row.mfr_sku, SL);
+ push('global', 'Brand', VENDOR, SL);
+ push('global', 'dw_sku', row.dw_sku, SL);
+ push('global', 'width', row.roll_width, SL);
+ push('custom', 'width', row.roll_width, SL);
+ if (row.pattern_name) { push('global', 'pattern_name', titleCase(row.pattern_name), SL); push('custom', 'pattern_name', titleCase(row.pattern_name), SL); }
+ if (row.color_name) {
+ push('custom', 'color', row.color_name, SL);
+ push('global', 'color', row.color_name, SL);
+ push('dwc', 'color', row.color_name, SL);
+ }
+ push('custom', 'fire_rating', row.fire_rating, SL);
+ push('global', 'material', row.material, SL);
+ push('custom', 'material', row.material, ML);
+ push('custom', 'collection_name', row.collection, SL);
return mf;
}
← 87b7133 title-caser preserves 3D/ABC/acronym tokens
·
back to Rebel Walls Push
·
rebel walls title: insert " Wallcoverings" before " | Rebel de60df5 →