[object Object]

← back to Designerwallcoverings

TK-12227: verify backs off on storefront cart 429

9a56596ba7e025abec5dd9f286baa7f95812fb51 · 2026-09-25 09:49:22 -0700 · Steve Abrams

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>

Files touched

Diff

commit 9a56596ba7e025abec5dd9f286baa7f95812fb51
Author: Steve Abrams <steve@designerwallcoverings.com>
Date:   Fri Sep 25 09:49:22 2026 -0700

    TK-12227: verify backs off on storefront cart 429
    
    Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
---
 scripts/palm-grove-promote/verify.mjs | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/scripts/palm-grove-promote/verify.mjs b/scripts/palm-grove-promote/verify.mjs
index cac9ff5..72c6f7b 100644
--- a/scripts/palm-grove-promote/verify.mjs
+++ b/scripts/palm-grove-promote/verify.mjs
@@ -22,11 +22,13 @@ const roll = js.variants.find(v => /Roll/.test(v.title)), samp = js.variants.fin
 ok('roll_114.03_pos1', roll && roll.price === 11403 && js.variants[0].id === roll.id && roll.available, JSON.stringify({ title: roll?.title, price: roll?.price, sku: roll?.sku, available: roll?.available }));
 ok('sample_4.25', samp && samp.price === 425 && samp.available, JSON.stringify({ price: samp?.price, sku: samp?.sku }));
 ok('featured_image', !!js.featured_image, js.featured_image?.split('?')[0].split('/').pop());
-// add to cart (fresh anonymous cart; no order created)
-const add = await fetch(`${SITE}/cart/add.js`, { method: 'POST', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify({ items: [{ id: roll?.id, quantity: 2 }] }) });
+// add to cart (fresh anonymous cart; no order created). Storefront cart API rate-limits (429) -> back off + retry.
+const _f = globalThis.fetch;
+const cartFetch = async (u, o) => { for (let i = 0; i < 5; i++) { const r = await _f(u, o); if (r.status !== 429) return r; await new Promise(z => setTimeout(z, 20000 * (i + 1))); } return _f(u, o); };
+const add = await cartFetch(`${SITE}/cart/add.js`, { method: 'POST', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify({ items: [{ id: roll?.id, quantity: 2 }] }) });
 const addj = await add.json().catch(() => ({}));
 ok('add_to_cart_roll_x2', add.status === 200 && addj.items?.[0]?.price === 11403, `${add.status} line_price=${addj.items?.[0]?.line_price}`);
-const adds = await fetch(`${SITE}/cart/add.js`, { method: 'POST', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify({ items: [{ id: samp?.id, quantity: 1 }] }) });
+const adds = await cartFetch(`${SITE}/cart/add.js`, { method: 'POST', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify({ items: [{ id: samp?.id, quantity: 1 }] }) });
 const addsj = await adds.json().catch(() => ({}));
 ok('add_to_cart_sample', adds.status === 200 && addsj.items?.[0]?.price === 425, `${adds.status}`);
 // twin redirect. Googlebot must get Shopify's 301 (shop_redirect). Browser navigation to an ARCHIVED

← 48cde5e TK-12227: contrarian fixes — pin inventory to twin roll loca  ·  back to Designerwallcoverings  ·  auto-data-snapshot: 2026-09-25T09:51:23 (4 data files) — scr 7f78ce0 →