# Commerce API Reference


> Find actual public hooks, helpers and types and understand declared contracts versus current runtime limits.


# Commerce API reference

Imports come from `@forgewp/woocommerce`. This inventory describes current source exports, not a guarantee that every combination passes package-wide typing or WordPress acceptance. Read [Cart State](https://www.forgewp.dev/docs/woocommerce/woo-cart/cart-state) before using the provider or convenience cart components.

## Catalog, display and fixture helpers

| Export | Contract |
| --- | --- |
| `IS_DEV` | Vite development-environment flag; not a store-readiness check. |
| `defineProducts` | Accept and return a typed product array; no server write. |
| `defineProduct` | Accept and return a typed product; no server write. |
| `useWpProducts` | Optional query params; products/loading/error/totals/page/refetch. Local fallback is not a filtered live query. |
| `useWpProduct` | ID or SKU lookup within the loaded collection; not slug lookup. |
| `useWpProductCategories` | Category collection from mock/hydrated taxonomy data. |
| `useWpProductTags` | Tag collection from mock/hydrated taxonomy data. |
| `useWpProductPrice` | No arguments; product-context preview or compiler marker. |
| `useWpProductSKU` | No arguments; product-context preview or compiler marker. |
| `useWpProductRating` | No arguments; product-context preview or compiler marker. |
| `useWpCurrency` | Currency settings and formatPrice helper from hydrated options/defaults. |
| `formatWpPrice` | Format amount with optional currency settings; defaults can use zero decimals. Not tax/discount calculation. |
| `useWpProductVariations` | Product object, ID, SKU or null; selection and display result. |

`WooCommerceProduct` requires `id` and `price`; optional fields include identity/content aliases, SKU, stock, dimensions, images, attributes, variations, grouped/external-product metadata and download/review data. A type allowing a product kind does not establish an accepted purchase flow for that kind.

## Interactive hooks and low-level helpers

| Export | Contract |
| --- | --- |
| `useWpCart` | Declared WpCartContextType; runtime depends on whether provider context exists. |
| `WpCartContext` | Nullable cart context. Provider/runtime shape mismatch remains open. |
| `fetchStoreApi` | Store API request helper with credentials and nonce handling; throws on unsuccessful HTTP. |
| `mapStoreApiToCartState` | Store API response to the older provider CartState, including minor-unit amounts. |
| `useWpCheckout` | Shipping/gateway data, processOrder, submission state and error; custom endpoint does not process payments. |
| `useWpCustomer` | Customer display/cache, account actions, orders/downloads and refresh actions; current logout integration is incomplete. |
| `useWpProductFilters` | URL-backed filter state and setters; not automatic catalog refetch. |
| `useWpWishlist` | Product IDs and optimistic local/attempted remote synchronization. |
| `useWpProductReviews` | Product ID and optional perPage/initialSort; collections, metrics, page/load-more and submit/delete/refresh actions. |

`CheckoutFormContext` and all component exports are documented in the [component reference](https://www.forgewp.dev/docs/woocommerce/woo-reference/components).

## Public types

| Area | Exports |
| --- | --- |
| Products | `ProductType`, `ProductDimensions`, `ProductVariation`, `ProductAttributeOption`, `ProductAttribute`, `ProductDownload`, `ProductReview`, `WooCommerceProduct`, `UseWpProductsParams` |
| Taxonomies | `WpProductCategory`, `WpProductTag` |
| Provider cart | `CartItem`, `CartTotals`, `CartState` |
| Standalone/cart contract | `WpCartLineItem`, `WpCartState`, `WpCartContextType` |
| Checkout | `ShippingMethod`, `PaymentGateway` |
| Customer | `CustomerProfile`, `OrderRecord`, `CustomerDownloadRecord` |
| Filters and prices | `ActiveFiltersState`, `WpCurrencySettings` |
| Variations | `UseWpProductVariationsReturn` |
| Reviews | `SubmitReviewParams`, `ReviewSortOption`, `UseWpProductReviewsOptions`, `UseWpProductReviewsReturn` |
| Component props | `WpProductLoopProps` |

Use `import type` for type-only imports. Public declarations are the best starting point for accepted argument shapes, but currently disagree with portions of the provider and cart-component implementation. Resolve those mismatches before treating a declared action return type as runtime evidence.

---

Source: [Commerce API Reference](https://www.forgewp.dev/docs/woocommerce/woo-reference/api-reference)
