Dev.to WebDev 🛠 Dev 👁 0 📖 4 min read

What I do with a client's tiny WooCommerce shop when I move them to Astro

Most of the WordPress sites I migrate have a little shop bolted on. Not a real store. Six candles, a gift voucher, a $40 workshop ticket. And it's running on WooCommerce with 14 plugins, a payment gateway nobody remember

Most of the WordPress sites I migrate have a little shop bolted on. Not a real store. Six candles, a gift voucher, a $40 workshop ticket. And it's running on WooCommerce with 14 plugins, a payment gateway nobody remembers setting up and a checkout page that takes 6 seconds to load.

When I move these clients to Astro the shop is the part that scares them most. Here's what I actually do now, after getting it wrong a couple of times.

1. Count what they really sell

Before touching anything I pull the WooCommerce orders export for the last 12 months. Not the product list, the orders. The product list lies, it's full of drafts and stuff from 2019.

What I'm looking for:

  • how many products actually sold
  • do any have variants (size, colour)
  • is anything shipped physically or is it all vouchers/tickets/digital
  • do they need stock tracking or is it "we'll email you if it's gone"

Nine times out of ten the answer is under 15 products, maybe one has sizes, no real stock tracking. That's not a store. That's a few buy buttons.

If it's 200 SKUs with inventory sync to a POS, I stop here and tell them to keep a proper ecommerce platform (Shopify, whatever) and just link to it from the new site. I don't try to be clever.

2. Pick the smallest thing that works

For the small ones I use one of two setups:

Stripe Payment Links when every product is a fixed price with no cart. Voucher, ticket, a single product. Each product gets a link, the button on the site just points at it. Stripe handles the checkout page, receipts, tax and the client already gets paid out to the same bank account.

Snipcart when they genuinely need a cart (people buy 3 candles at once) or shipping rules. It's a script tag plus some data attributes on the buy buttons, so it works fine on a static site.

Either way there's no server, no plugin updates, no checkout that breaks when PHP gets bumped.

3. Products live in a JSON file

This is the bit that made it click for clients. I put the products in /data/products.json:

[
  {
    "slug": "lavender-candle",
    "name": "Lavender soy candle",
    "price": 32,
    "image": "/img/shop/lavender.webp",
    "buyUrl": "https://buy.stripe.com/xxxx",
    "soldOut": false
  }
]

The Astro shop page reads that file at build time and renders the grid. On novence.ai the client can open /edit on their own site, log in with an emailed code (no password to forget) and change price, flip soldOut, or swap the payment link. They dont need me for "we ran out of the blue ones".

New product still comes to me because it needs a photo and a new Stripe link, but thats maybe twice a year.

4. Keep the old product URLs alive

WooCommerce URLs look like /product/lavender-candle/ and /product-category/candles/. Some of those have backlinks from local blogs or Instagram bios. So in /_redirects:

/product/:slug/   /shop/:slug/   301
/product-category/*   /shop/   301
/cart/   /shop/   301
/checkout/   /shop/   301
/my-account/*   /   301

I get my coding agent to generate the product lines from the orders export and diff them against the new pages so nothing 404s. Cart and checkout just go to the shop page, nobody bookmarks a cart.

5. Tell them about customer accounts early

This is the one that bit me. WooCommerce had customer accounts, order history, saved addresses. Payment Links and Snipcart dont work the same way. Stripe sends receipts, Snipcart has its own customer portal, but "log in and see my orders from 2022" is gone.

For tiny shops nobody actually used it. But I tell the client before, not after. And I export the old orders to a CSV they keep, so if someone emails asking about a 2023 order they can still look it up.

6. Test a real purchase before DNS moves

I deploy the new site to the preview URL with npx novence deploy ./dist and do one real purchase with a real card, then refund it. Not test mode. Test mode doesnt catch the "payout account was never verified" problem, and I have hit that exactly once which was enough.

Then the checks run (links, lighthouse, a11y) and only after that I touch DNS.

What the client ends up with

  • a shop page that loads instantly
  • products they can edit themselves
  • a checkout run by Stripe or Snipcart that they never have to update
  • no WooCommerce, no plugin renewals, no hosting plan just to keep a cart alive

And for me it means the shop is just another page in the repo. Same deploy as every other client site.

If your migrating WordPress sites for clients and keep hitting the "but what about my shop" question, this is the boring answer that's worked for me. Curious what others use for the in between cases, the 30 to 50 product shops are still the awkward ones.

📰 Read the original article on Dev.to WebDev

Originally published by Dev.to WebDev. Aggregated on AIWithGhost for educational purposes — full credit and traffic to the original publisher.