# WooCommerce Native Storefront

Reference

- [Getting Started](https://spacepress.dev/docs/getting-started/)
  - [Installation & Setup](https://spacepress.dev/docs/getting-started/installation/)
  - [Project Structure](https://spacepress.dev/docs/getting-started/project-structure/)
- [Core Framework](https://spacepress.dev/docs/core/)
  - [Schema & Storage](https://spacepress.dev/docs/core/schema-and-storage/)
  - [Queries & Access Control](https://spacepress.dev/docs/core/queries-and-access/)
  - [Actions, Jobs, Hooks & HTTP Routes](https://spacepress.dev/docs/core/actions-jobs-routes/)
  - [Pages, Layouts & Interactive Islands](https://spacepress.dev/docs/core/pages-and-islands/)
- [Integrations & Ecosystem](https://spacepress.dev/docs/integrations/)
  - [Two-Way Markdown & Git Sync](https://spacepress.dev/docs/integrations/markdown-sync/)
  - [WooCommerce Native Storefront](https://spacepress.dev/docs/integrations/woocommerce/)
  - [React Email Templates](https://spacepress.dev/docs/integrations/react-email/)
  - [Astro & Generated Typed Clients](https://spacepress.dev/docs/integrations/astro-and-clients/)
- [Operations & Tooling](https://spacepress.dev/docs/operations/)
  - [CLI & Deployment](https://spacepress.dev/docs/operations/cli-and-deploy/)
  - [MCP & AI Agents](https://spacepress.dev/docs/operations/mcp-and-agents/)
  - [Deploy on Spacefast](https://spacepress.dev/docs/operations/deploy-spacefast/)
  - [Deploy on Pressable & WordPress.com (WP Cloud)](https://spacepress.dev/docs/operations/deploy-wp-cloud/)
  - [Deploy on Self-hosted WordPress](https://spacepress.dev/docs/operations/deploy-self-hosted/)
- [Reference](https://spacepress.dev/docs/reference/)
  - [Host Contract](https://spacepress.dev/docs/reference/host-contract/)
  - [Tested Compiler Compatibility](https://spacepress.dev/docs/reference/language-support/)

# WooCommerce Native Storefront

> For AI coding agents: start with [/start.md](/start.md) (build playbook) and [/rules.md](/rules.md) (compiler rules), see [/llms.txt](/llms.txt) for the complete documentation index, or read this page as Markdown at [/md/docs/integrations/woocommerce.md](/md/docs/integrations/woocommerce.md).

[View Markdown.md source ↗](/md/docs/integrations/woocommerce.md)[Open in ChatGPTAsk about this page ↗](https://chatgpt.com/?q=Read%20https%3A%2F%2Fspacepress.dev%2Fmd%2Fdocs%2Fintegrations%2Fwoocommerce.md%20%28WooCommerce%20Native%20Storefront%29%20and%20help%20me%20with%20questions%20about%20it.)[Open in ClaudeAsk about this page ↗](https://claude.ai/new?q=Read%20https%3A%2F%2Fspacepress.dev%2Fmd%2Fdocs%2Fintegrations%2Fwoocommerce.md%20%28WooCommerce%20Native%20Storefront%29%20and%20help%20me%20with%20questions%20about%20it.)[start.mdAgent build playbook ↗](/start.md)[rules.mdCompiler rules ↗](/rules.md)[llms.txtFull site index ↗](/llms.txt)

Configure WooCommerce stores, products, shipping zones, orders, and optimistic cart hooks in TypeScript.

## Scaffolding a storefront

Add a complete WooCommerce storefront to any project with:

```bash
npx typedpress add shop
```

## Declarative store & catalog builders

Export `store()`, `product()`, `productCategory()`, `productTag()`, and `order()` from `tp/shop.ts` (re-exported in `typedpress.config.ts`):

```ts
import { store, product, productCategory, productTag, order } from "typedpress";

export const shop = store({
  currency: "EUR",
  country: "PL",
  sellTo: ["PL", "DE"],
  shipping: [
    {
      name: "Poland",
      countries: ["PL"],
      methods: [
        { type: "flatRate", title: "Courier", cost: "15.00" },
        { type: "freeShipping", title: "Free over 200", minimum: "200.00" },
      ],
    },
  ],
  payments: ["cod"],
});

export const products = product({ sync: "content/products/*.md", url: "/products/:slug" });
export const categories = productCategory({ url: "/shop/:path" });
export const tags = productTag();
export const orders = order();
```

## Optimistic cart client & React hooks

Whenever a project exports `store()`, `typedpress build` emits `commerce.ts`, `cart-store.ts`, and `cart-react.ts` in `tp/\_generated/client/`. Call `createCartHooks(React)` to obtain `useCart()` and `useCartCount()` with optimistic item quantity updates and automatic rollback on failure.

[← Previous**Two-Way Markdown & Git Sync**](https://spacepress.dev/docs/integrations/markdown-sync/)[Next →**React Email Templates**](https://spacepress.dev/docs/integrations/react-email/)

On this page

- [Scaffolding a storefront](#scaffolding-a-storefront)
- [Declarative store & catalog builders](#declarative-store--catalog-builders)
- [Optimistic cart client & React hooks](#optimistic-cart-client--react-hooks)
