You can run a WooCommerce store with Astro in front of it in two ways. The hybrid way builds product and category pages in Astro and keeps the cart and checkout on WooCommerce, for example on a subdomain. The fully headless way builds the cart and checkout in Astro too, talking to WooCommerce through its Store API. The hybrid way is cheaper and keeps your payment gateways working as they do today; fully headless gives you full control of the buying journey but costs more and breaks more plugins.
This article is for store owners, marketing leads and agencies who like Astro's speed and want to know what happens to the cart, payments, stock and SEO when WooCommerce stays as the engine. If you would rather have the whole build handled for you, our Astro website development team does exactly this kind of project.
Why Astro and WooCommerce are paired at all
Astro and WooCommerce are paired because each is good at the half the other is weak at. Astro builds very fast pages that send plain HTML and only load JavaScript where it is needed. WooCommerce runs the shop: products, stock, tax, shipping, coupons, payments, orders and customer emails, all managed in a WordPress admin your team may already know.
Astro does not try to be a shop. Its own e-commerce guide (opens in a new tab) covers Lemon Squeezy, Paddle and Snipcart, and does not mention WooCommerce at all. So when we talk about Astro and WooCommerce, we mean Astro as the shop window and WooCommerce as the till and the stockroom.
This only makes sense if the shop window is where you lose sales. A slow catalogue, heavy theme or page builder on product pages are good reasons. A store whose real problem is stock control or shipping rules will not get better from a new front end; our guide to speeding up a WooCommerce store may be the cheaper fix.
The two ways to build it
There are two main setups, and the choice comes down to where the cart lives.
| Hybrid: Astro catalogue, WooCommerce checkout | Fully headless with the Store API | |
|---|---|---|
| Product and category pages | Astro | Astro |
| Cart | WooCommerce, on a subdomain such as shop.example.com | Astro, using the Store API |
| Checkout and payment | WooCommerce, unchanged | Astro form posting to the Store API, plus gateway scripts |
| Payment gateways | Keep working as they do now | Only gateways you can make work through the Store API |
| Checkout plugins (fields, upsells, tax tools) | Keep working | May need rebuilding or replacing |
| Build effort | Lower | Much higher |
| Who it suits | Stores happy with their current checkout | Stores with a custom buying journey and budget to maintain it |
The hybrid setup
In the hybrid setup, Astro builds the pages people browse and Google indexes: home, categories, products, guides and the blog. The "Add to cart" button sends the shopper to WooCommerce, which handles everything from the cart onwards on its own theme.
WooCommerce supports this out of the box with add-to-cart URLs (opens in a new tab). A link such as the one below adds a product and lands the shopper on the cart page; using a variation ID does the same for a variable product.
https://shop.example.com/cart/?add-to-cart=123&quantity=1The trade-off is a handover between two hostnames, so the WooCommerce cart and checkout theme must be styled to match the Astro site.
The fully headless setup
In the fully headless setup, the cart and checkout are built in Astro and talk to WooCommerce through the Store API (opens in a new tab). This is WooCommerce's public, customer-facing API for products, cart and checkout. It needs no API keys and can only see the current shopper's data, which is why it is safe to call from the browser. The older WooCommerce REST API with consumer keys is for admin data such as orders and should only run on a server.
You get full control of the flow, such as a slide-out cart or one-page checkout, and you take on everything WooCommerce's own checkout used to do.
- Astro product page
- Store API cart with Cart-Token
- Astro checkout form
- Store API checkout
- Gateway confirms payment
How the cart works without cookies
A headless cart keeps track of the shopper with a Cart-Token header instead of a WordPress cookie. According to the WooCommerce cart tokens documentation (opens in a new tab), a request to the cart endpoint returns a Cart-Token header. You store it in the browser and send it back with every cart and checkout request. With a Cart-Token, the nonce that WordPress normally needs is not required.
const res = await fetch("https://shop.example.com/wp-json/wc/store/v1/cart");
const cartToken = res.headers.get("Cart-Token");
// send it back on later calls: headers: { "Cart-Token": cartToken }CORS and the 9.8 change
When Astro runs on example.com and WooCommerce on shop.example.com, every cart call is a cross-origin request, and the browser decides which response headers your code can read. Before WooCommerce 9.8, the Cart-Token header was not exposed in those requests, so developers needed a server-side proxy. The WooCommerce 9.8 Store API update (opens in a new tab) exposed the Cart-Token in CORS-protected requests (the nonce is still not exposed), so the browser can talk to the Store API directly.
Keep WooCommerce updated, because older versions still need the proxy, and test CORS on your real hosting, since security plugins, firewalls and CDN rules can block headers. A small Astro server endpoint that forwards cart calls is still a fair choice when the hosting is strict.
If you would rather not set up the Cart-Token flow, CORS rules and checkout yourself, our Astro developers can build and test it for you.
Payments: the riskiest part
Payment gateways are the biggest risk in a fully headless WooCommerce store. The Store API checkout endpoint (opens in a new tab) takes the billing address, shipping address, a payment method ID and optional payment_data that is passed through to the gateway. The WooCommerce docs note that each gateway may expect different data, and point you to the gateway's own authors for details.
In plain words: offline methods such as bank transfer or cash on delivery collect no card details, so they are simpler to support. Card gateways are harder. The checkout docs use Stripe as the example: the card is handled by the gateway's own code first, and the result is passed in payment_data. The docs also warn that a gateway may change the data it expects between releases. So in a headless checkout you add each gateway's code to your Astro page, pass its result through yourself, and test again whenever the gateway plugin updates.
This is the strongest argument for the hybrid setup. With the checkout left on WooCommerce, every gateway works the way its maker tested it. If your store uses a local gateway, a buy-now-pay-later option or several wallets, check each one before you plan a headless checkout. Our team handles WooCommerce checkout and payment gateway work if you need a gateway tested or fixed. For one fully headless build with Razorpay, see how we rebuilt a slow WooCommerce shop in Astro, where WooCommerce still prices the cart and our server checks every payment.
Keeping prices and stock fresh
A static product page can show yesterday's price or say "in stock" when the last item sold an hour ago. Astro gives you three ways to deal with this, and you can mix them.
- Rebuild on change. A WooCommerce webhook triggers a rebuild of the Astro site when a product is saved. Simple, and suits catalogues that do not change often.
- Render pages on request. Product pages are rendered on the server for each visit, ideally with short caching, so they always show current data. This needs an Astro adapter for your host.
- Server islands. The page stays static and fast, and only the price, stock badge and add-to-cart button load as a small live part. Astro's server islands (opens in a new tab) do this with the
server:deferdirective and a fallback shown while the live part loads. They also need an adapter.
<StockAndPrice server:defer productId={product.id}>
<p slot="fallback">Checking stock...</p>
</StockAndPrice>Whatever you choose, the cart and checkout always recheck price and stock with WooCommerce before the order is placed, so a stale page cannot sell at the wrong price. The checkout endpoint even accepts an expected_total and returns an error if the total has changed. The risk of stale pages is a poor experience, not a wrong order.
What can break when you go headless
Anything that relied on the WordPress theme to show itself to shoppers stops appearing once Astro builds the pages. The WooCommerce data is still there; the display is gone.
| What | Why it breaks | Fix |
|---|---|---|
| Plugins that inject into product templates (badges, size guides, bundles, wishlists) | They hook into theme templates that Astro does not use | Rebuild the display in Astro from the plugin's data, or drop the plugin |
| Checkout field and upsell plugins | They modify WooCommerce's own checkout | Keep the checkout on WooCommerce (hybrid) |
| Card and wallet gateways | They can rely on their own scripts on the checkout page | Hybrid checkout, or custom integration per gateway |
| Product reviews and Q and A | Shown by the theme | Fetch through the Store API or REST API and render in Astro |
| Tracking pixels and analytics events | Added by plugins to theme pages | Add them in Astro, with care for consent |
| Live search and filters | Can be plugin-driven on the theme | Build search in Astro or use a search service |
Before any build, list every plugin on the store and mark it as data only, shown on product pages, or part of checkout. That list decides between hybrid and headless.
SEO for Astro product pages
Astro product pages can be very strong for SEO, because they arrive as clean HTML that loads fast. The work is in carrying over what WooCommerce and your SEO plugin used to output.
- Product structured data in the HTML. Google's merchant listing documentation (opens in a new tab) requires a product name, image and an offer with a price and currency. It also warns that markup added by JavaScript can make Shopping crawls less frequent and less reliable, so put it in the HTML Astro sends.
- Same URLs, or 301 redirects. If product URLs change, map every old URL to its new one before launch, as in our WordPress to Astro migration checklist.
- Canonicals and sitemaps on the right domain. In the hybrid setup, the Astro domain should own product URLs, and the shop subdomain's cart and checkout pages should be kept out of search.
- Titles and descriptions from your SEO plugin. These can be pulled from WordPress, as covered in our guide to Astro with headless WordPress.
Which stores it suits
Astro in front of WooCommerce suits stores where browsing and content matter more than a custom checkout, and where page speed costs them sales.
Good fit:
- Catalogue-led stores with many product and category pages and a blog or buying guides
- Stores already happy with WooCommerce admin, payments and shipping, but stuck with a slow theme
- Brands that want a custom design without page-builder weight
Poor fit:
- Very small stores, where a fast WooCommerce theme is cheaper
- Stores built around complex checkout plugins, subscriptions or bookings that live in the checkout
- Teams without a developer or agency to look after two systems
The hub post on the best headless CMS for Astro puts WooCommerce in context with the other options, and our guide to what an Astro website costs helps with the budget.
Where to start
Start with a plugin and gateway audit, then pick the setup. We suggest the hybrid setup first: Astro for the catalogue, WooCommerce for cart and checkout, and server islands for price and stock. A headless cart can come later, once the catalogue is live and earning.
If you want help with the audit or the build, our Astro website development service covers headless WooCommerce, and our WooCommerce development team looks after the store side.
Frequently asked questions
Can Astro work with WooCommerce?
Yes. Astro can read products and categories from WooCommerce and render fast product pages, while WooCommerce keeps handling the cart, checkout, payments and orders. You can also build the cart and checkout in Astro using the WooCommerce Store API, but that takes more work.
Will my payment gateway work with a headless Astro checkout?
It depends on the gateway. Offline methods such as bank transfer are simpler to support. Card and wallet gateways can need their own scripts and custom work, because the WooCommerce docs say each gateway expects different payment data. Keeping the checkout on WooCommerce avoids this.
Will Astro product pages show the wrong price or stock?
They can if pages are only rebuilt now and then. Server islands or on-request rendering keep price and stock fresh, and WooCommerce always rechecks the price and stock at checkout, so orders are placed at the correct price.
Sources
The facts in this article were checked against these pages, last reviewed 26 November 2026.
- E-commerce guide, Astro Docsdocs.astro.build/en/guides/ecommerce/
- Server islands, Astro Docsdocs.astro.build/en/guides/server-islands/
- Store API, WooCommerce Developer Docsdeveloper.woocommerce.com/docs/apis/store-api/
- Cart tokens, WooCommerce Developer Docsdeveloper.woocommerce.com/docs/apis/store-api/cart-tokens/
- Store API updates coming in WooCommerce 9.8, WooCommerce Developer Blogdeveloper.woocommerce.com/2025/04/02/store-api-updates-coming-in-woocommerce-9-8/
- Checkout API, WooCommerce Developer Docsdeveloper.woocommerce.com/docs/apis/store-api/resources-endpoints/checkout/
- Creating WooCommerce add-to-cart URLs, WooCommercewoocommerce.com/document/quick-guide-to-woocommerce-add-to-cart-urls
- Merchant listing structured data, Google Search Centraldevelopers.google.com/search/docs/appearance/structured-data/merchant-listing




