Shopify product image fetching via /products.json — two exported functions with distinct deduplication behaviors
This skill triggers when editing these files:
lib/product-images.tstests/product-images.test.tsKeywords: fetchProducts, fetchProductImages, ProductInfo, products.json
You are working on Shopify product image fetching for call card visuals.
lib/product-images.ts — two exported functions + internal Shopify typestests/product-images.test.ts — vitest node environment, stubs global fetch| Function | Returns | Deduplication | Used by |
|---|---|---|---|
fetchProducts(domain) | ProductInfo[] | By title (case-insensitive) — one entry per unique product |
| detection route, stores route, batch-processor |
fetchProductImages(domain) | string[] | None — flatMaps all images across products | batch-processor, stream route |
https://${domain}/products.json?limit=6 with AbortSignal.timeout(5000) — always returns [] on any failure (never throws)fetchProducts skips products with no images and deduplicates by p.title.toLowerCase().trim() — the 6-limit applies to unique productsfetchProductImages deduplicates nothing — the 6-limit applies to total image URLs via .slice(0, 6)/products.json — fetchProducts guards with content-type.includes('json') check; fetchProductImages does NOT have this guardProductInfo shape: { title, image, handle } where image is p.images[0].src only.claude/skills/product-images/skill.mdLast Updated: 2026-03-31