← back to Dw Unbuyable Recovery Pilot

tk11252-hollywood/verify-rendered.sh

26 lines

#!/bin/bash
# Rendered-plane verification: for each unbuyable product, does the LIVE page
# give the customer ANY path (quote CTA)? Admin tags are not evidence; the page is.
out=./rendered-verify.tsv
: > "$out"
node -e "
const t=require('./unbuyable-tags.json');
for(const p of t) console.log([p.variants.nodes[0].sku, p.handle, p.tags.map(x=>x.toLowerCase()).includes('quotes')?'tag_quotes':'tag_none'].join('\t'));
" | while IFS=$'\t' read -r sku handle tagstate; do
  f=$(mktemp)
  code=$(curl -sL --max-time 45 -o "$f" -w '%{http_code}' -A 'Mozilla/5.0 (Macintosh)' "https://designerwallcoverings.com/products/$handle")
  if [ "$code" != "200" ]; then
    printf '%s\t%s\t%s\t%s\tNOT_MEASURED\thttp_%s\n' "$sku" "$handle" "$tagstate" "$code" "$code" >> "$out"
  else
    q=$(grep -ioc 'request a quote' "$f")
    verdict=$([ "$q" -gt 0 ] && echo HAS_QUOTE_PATH || echo DEAD_END)
    printf '%s\t%s\t%s\t200\t%s\tquoteCTA=%s\n' "$sku" "$handle" "$tagstate" "$verdict" "$q" >> "$out"
  fi
  rm -f "$f"
  sleep 0.4
done
echo "--- results ---"
column -t -s $'\t' "$out"
echo "--- tally ---"
awk -F'\t' '{c[$5]++} END{for(k in c) print k, c[k]}' "$out"