Prompt to convert a Shopify export to Astro

Short answer

This prompt asks an AI coding assistant to rebuild a WebExport copy of a Shopify storefront in Astro. Product and collection pages become templates fed by a data file that holds only values found in the saved HTML. Cart scripts are removed, and buy buttons link to your Shopify store.

Last reviewed

Key facts

  • Astro can load a data file through a content collection with the file() loader.
  • The saved copy has no cart or checkout, so buying stays on Shopify.
  • Prices and stock reflect the export date, not live inventory.
  • Test status: Astro steps tested on a real export (Astro 7.4.13), Shopify cleanup not yet tested.

The prompt

Paste this into your AI coding assistant with the unzipped export open, and replace the placeholders in square brackets.

Shopify to Astro
You are helping me move a static export of a Shopify site to Astro.

CONTEXT
- ./exported-site is a WebExport download of my Shopify site: HTML, CSS, JavaScript, fonts and images.
- Live site for comparison: [LIVE_URL]. Final domain: [DOMAIN]. Host: [HOST: Vercel, Netlify, Cloudflare Pages, Amazon S3 or Nginx].

TARGET: Astro
- Astro project, one .astro file per page in src/pages with the old paths, one layout in src/layouts, repeated parts as components.
- Assets and untouched scripts go to public/. Delete the scaffold's placeholder src/pages/index.astro before adding the converted home page.
- Output is static, and astro build must write every page to dist/.

SHOPIFY-SPECIFIC CLEANUP
- Remove calls to /cart.js, /cart/add.js and product .js endpoints. They only exist on Shopify.
- Replace add to cart with a link to the product on [STORE_URL]. Do not build a cart or checkout.
- Keep /products/<handle> and /collections/<handle> as paths.
- Extract product data only from values present in the saved HTML. Leave missing fields empty and list them.
- Search for cdn.shopify.com. Download or replace each hit.

RULES
- Keep the design and every URL path. List path changes in REDIRECTS.md.
- Do not invent content, prices or links. Report gaps in MIGRATION_NOTES.md.
- Build after each step and ask before deleting a script or stylesheet.

START
Inventory the folder, show me a plan, wait for my go-ahead, then convert the home page only.

How to run it

  1. Unzip the download to ./exported-site and create the Astro project beside it.
  2. Paste the prompt, approve the plan, convert the layout and home page, then the rest in small groups.

What to expect from Shopify to Astro

A catalog is repetitive by nature, so it is a good fit for templates. The assistant extracts name, handle, price, image and description from each saved product page into a data file, then builds one product template and one collection template. Fields that are not in the HTML stay empty and are listed in the notes.

Astro keeps the output static, so the storefront serves quickly from any host. The cost is that product data refreshes only when you rebuild. Plan a re-export and rebuild for price changes, or accept that the static site is a catalog and Shopify remains the source of truth.

Questions the assistant should ask you

  • Which product fields should go in the data file?
  • Do all products share one template, or do some need their own layout?
  • How often will you re-export to refresh prices?

Verify the result

Run these from the project folder after each batch. The last command lists files that still refer to Shopify.

terminal
npm install
npm install @astrojs/check typescript   # astro check asks for these on first run
npx astro check
npm run build
npx astro preview

# files that still refer to the old platform
grep -rlE "cdn.shopify.com|/cart.js" src public | head
  • astro check exits with code 0 and dist holds a page for every old sitemap route.
  • astro preview matches the live site at two widths.
  • Click every buy button and confirm it opens the right product on your Shopify store.
  • Compare ten product titles and prices with the live store.

What can go wrong

  • The assistant fills missing fields with plausible values. The prompt forbids it, and you should spot-check ten products against the live store.
  • Variant selectors depend on Shopify scripts. Replace them with links to the product on your store.
  • Collection pages with filters generated by scripts lose the filters. Decide whether to drop them or rebuild with a small script.

Frequently asked questions

Can the Astro site sell products?

Not by itself. Send buyers to your Shopify store, or add a hosted buy button for each product.

How do I check the extracted product data?

Open ten product pages on the live store and compare the price, title and image with the data file. The prompt asks the assistant to list any field it could not find.

Do I keep the Shopify URL structure?

Yes, keep /products/handle and /collections/handle. Search engines already know them.

Where should I host it?

Any static host. The Shopify on Netlify guide shows how to send /cart and /checkout back to the store.

Official documentation

Free tools for this job

Start with the files

The prompt works on a WebExport download. Paste your public Shopify URL into the export form and get a ZIP. The Free plan covers 1 site, 5 exports a month, 15 pages and 20 MB per export. Professional is a $9.99 one-time purchase with unlimited pages.