← back to Designer Wallcoverings
Add dry-run go-live push script for MOQ section (backup + rollback)
2edc5f6e764d4015a6fb4cef91327536a8e30307 · 2026-06-22 13:59:23 -0700 · Steve Abrams
Files touched
A shopify/theme-moq/push-section-to-live.py
Diff
commit 2edc5f6e764d4015a6fb4cef91327536a8e30307
Author: Steve Abrams <steve@designerwallcoverings.com>
Date: Mon Jun 22 13:59:23 2026 -0700
Add dry-run go-live push script for MOQ section (backup + rollback)
---
shopify/theme-moq/push-section-to-live.py | 55 +++++++++++++++++++++++++++++++
1 file changed, 55 insertions(+)
diff --git a/shopify/theme-moq/push-section-to-live.py b/shopify/theme-moq/push-section-to-live.py
new file mode 100644
index 00000000..79d1338a
--- /dev/null
+++ b/shopify/theme-moq/push-section-to-live.py
@@ -0,0 +1,55 @@
+#!/usr/bin/env python3
+"""
+Push the MOQ-fixed custom PDP section to a theme (LIVE go-live step).
+
+SAFE BY DEFAULT: dry-run unless --execute. Backs up the target theme's current
+sections/product.liquid before writing (so rollback is one PUT of the .bak).
+
+Usage:
+ python3 push-section-to-live.py # dry-run vs LIVE theme 143739584563
+ python3 push-section-to-live.py --execute # writes FIXED to LIVE theme (+ backup)
+ python3 push-section-to-live.py --theme <id> --execute
+
+Targets the live "NewWall Template [Dev]" theme by default (role=main).
+Token: theme-scoped token from DW-Agents/dw-agents/update-theme-quantity.js.
+"""
+import sys,os,json,urllib.request,re,time
+
+HERE=os.path.dirname(os.path.abspath(__file__))
+REPO=os.path.abspath(os.path.join(HERE,"..",".."))
+STORE="designer-laboratory-sandbox.myshopify.com"
+KEY="sections/product.liquid"
+LIVE_THEME="143739584563" # NewWall Template [Dev], role=main
+def token():
+ js=open(os.path.join(REPO,"DW-Agents","dw-agents","update-theme-quantity.js")).read()
+ m=re.search(r"shpat_[a-f0-9]{32}", js)
+ if not m: raise SystemExit("theme token not found")
+ return m.group(0)
+TT=token()
+def api(method, path, body=None):
+ req=urllib.request.Request("https://%s/admin/api/2024-01/%s"%(STORE,path),
+ data=json.dumps(body).encode() if body else None, method=method,
+ headers={"X-Shopify-Access-Token":TT,"Content-Type":"application/json"})
+ return json.load(urllib.request.urlopen(req))
+
+def main():
+ execute="--execute" in sys.argv
+ theme=LIVE_THEME
+ if "--theme" in sys.argv: theme=sys.argv[sys.argv.index("--theme")+1]
+ fixed=open(os.path.join(HERE,"sections-product.FIXED.liquid"),encoding="utf-8").read()
+ cur=api("GET","themes/%s/assets.json?asset[key]=%s"%(theme,KEY.replace('/','%2F')))['asset']['value']
+ print("Target theme:",theme,"| current section size:",len(cur),"| FIXED size:",len(fixed))
+ print("Current has hardcoded min=1:", 'value="1" min="1"' in cur)
+ print("FIXED reads metafield:", 'v_prods_quantity_order_min' in fixed)
+ if not execute:
+ print("\nDRY-RUN. Re-run with --execute to write FIXED to theme %s (backup saved first)."%theme)
+ return
+ # backup current
+ bak=os.path.join(HERE,"sections-product.LIVE-%s.prepush.bak.liquid"%theme)
+ open(bak,"w",encoding="utf-8").write(cur)
+ print("backup ->",bak)
+ api("PUT","themes/%s/assets.json"%theme, {"asset":{"key":KEY,"value":fixed}})
+ print("PUT done. Rollback: PUT the .bak back to key",KEY)
+
+if __name__=="__main__":
+ main()
← f9ca2f62 Harden MOQ Liquid: use append-coercion for legacy global met
·
back to Designer Wallcoverings
·
Restore grid density slider + add product descriptions to co f68f5a77 →