← back to Majilite Onboard
Dual-list Majilite: add Fabric + Wallcovering tags to all 160 (list under both aisles)
4006a517731864b5036dff05e0b6bbc762f56982 · 2026-08-10 11:39:19 -0700 · Steve Abrams
Files touched
A scripts/add_dual_tags.js
Diff
commit 4006a517731864b5036dff05e0b6bbc762f56982
Author: Steve Abrams <steve@designerwallcoverings.com>
Date: Mon Aug 10 11:39:19 2026 -0700
Dual-list Majilite: add Fabric + Wallcovering tags to all 160 (list under both aisles)
---
scripts/add_dual_tags.js | 22 ++++++++++++++++++++++
1 file changed, 22 insertions(+)
diff --git a/scripts/add_dual_tags.js b/scripts/add_dual_tags.js
new file mode 100644
index 0000000..00a8569
--- /dev/null
+++ b/scripts/add_dual_tags.js
@@ -0,0 +1,22 @@
+const fs=require('fs'),path=require('path');
+const STORE='designer-laboratory-sandbox.myshopify.com';
+const TOKEN=(fs.readFileSync(path.join(process.env.HOME,'Projects/secrets-manager/.env'),'utf8').match(/^SHOPIFY_ADMIN_TOKEN=(.+)$/m)||[])[1].replace(/["']/g,'').trim();
+const GQL=`https://${STORE}/admin/api/2024-10/graphql.json`;
+const sleep=ms=>new Promise(r=>setTimeout(r,ms));
+async function gql(q,v){for(let a=0;a<6;a++){const r=await fetch(GQL,{method:'POST',headers:{'X-Shopify-Access-Token':TOKEN,'Content-Type':'application/json'},body:JSON.stringify({query:q,variables:v})});const j=await r.json();if(j.errors){if(JSON.stringify(j.errors).includes('THROTTLED')){await sleep(1500*(a+1));continue;}throw new Error(JSON.stringify(j.errors).slice(0,200));}return j.data;}throw new Error('throttled');}
+const TAGS=['Fabric','Wallcovering']; // dual-list: both aisles (DW categorizes by tag)
+(async()=>{
+ let all=[],c=null;
+ do{const d=await gql(`query($c:String){ products(first:100, after:$c, query:"vendor:Majilite"){ pageInfo{hasNextPage endCursor} nodes{ id title } } }`,{c});
+ all.push(...d.products.nodes); c=d.products.pageInfo.hasNextPage?d.products.pageInfo.endCursor:null;}while(c);
+ console.log('Majilite products:',all.length,'| adding tags:',TAGS.join(', '));
+ let ok=0,err=0;
+ for(const p of all){
+ try{ const d=await gql(`mutation($id:ID!,$tags:[String!]!){ tagsAdd(id:$id, tags:$tags){ userErrors{message} } }`,{id:p.id,tags:TAGS});
+ const ue=d.tagsAdd.userErrors; if(ue&&ue.length){err++; if(err<=5)console.log(' ✗',p.title,JSON.stringify(ue));} else ok++;
+ }catch(e){err++; if(err<=5)console.log(' ✗',p.title,e.message.slice(0,60));}
+ if(ok%40===0&&ok)process.stdout.write(` …${ok} tagged\n`);
+ await sleep(160);
+ }
+ console.log(`DONE. tagged_ok=${ok} errors=${err}`);
+})();
← 444c2f9 Set Majilite collection cover image (Stature Gold swatch)
·
back to Majilite Onboard
·
Publish all 160 Majilite + collection to ALL 13 sales channe 8889c9b →