# Install and Prepare Product Data


> Install the commerce package and create typed fixtures without confusing local data with WordPress products.


# Install and prepare product data

Start from a working ForgeWP React theme. Its commerce peers include React, `@forgewp/react` and `lucide-react`. Inspect `package.json` first: some scaffolds already include the package.

**@forgewp/woocommerce**

**pnpm**

```bash
pnpm add @forgewp/woocommerce
```

**npm**

```bash
npm install @forgewp/woocommerce
```

**yarn**

```bash
yarn add @forgewp/woocommerce
```

**bun**

```bash
bun add @forgewp/woocommerce
```

Activate WooCommerce on the installed WordPress site and configure real products, currency, taxes, shipping and the selected payment plugins. Importing the package does not configure or verify a store.

## Typed local products

**cms/products.ts**

```ts
import { defineProducts } from "@forgewp/woocommerce"

export default defineProducts([
  { id: 101, name: "Canvas bag", slug: "canvas-bag", type: "simple",
    price: "24.00", stock_status: "instock", sku: "BAG-101" },
])
```

`defineProducts` and `defineProduct` are identity helpers for type checking. They do not save products to WordPress. The runtime supplies preview products through `window._forgeWpMockPosts.product`; use the CMS-loading workflow rather than assigning that global in production.

Fixture seeding is separate and opt-in. `seed.products` defaults to false. Review [seeding configuration](https://www.forgewp.dev/docs/core/api-reference/config-reference) before enabling a strategy on a test site.

## Origins and credentials

The commerce API-base resolver checks browser `FORGEWP_API_URL`, Vite `VITE_WP_API_URL`, process `NEXT_PUBLIC_WP_API_URL`/`WP_API_URL`, the pathname of hydrated WordPress `home`, then the current origin root. It is separate from the newer Auth resolver. The base precedes `/wp-json`; do not duplicate that suffix.

Requests generally include credentials. Verify subdirectory paths, REST nonce hydration, cookies and CORS on the deployment. Setting a URL does not itself establish a cross-origin session. Never embed WooCommerce admin consumer secrets in frontend code.

---

Source: [Install and Prepare Product Data](https://www.forgewp.dev/docs/woocommerce/woo-core/installation)
