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 before using the provider or convenience cart components.
Catalog, display and fixture helpers
Export Contract IS_DEVVite development-environment flag; not a store-readiness check. defineProductsAccept and return a typed product array; no server write. defineProductAccept and return a typed product; no server write. useWpProductsOptional query params; products/loading/error/totals/page/refetch. Local fallback is not a filtered live query. useWpProductID or SKU lookup within the loaded collection; not slug lookup. useWpProductCategoriesCategory collection from mock/hydrated taxonomy data. useWpProductTagsTag collection from mock/hydrated taxonomy data. useWpProductPriceNo arguments; product-context preview or compiler marker. useWpProductSKUNo arguments; product-context preview or compiler marker. useWpProductRatingNo arguments; product-context preview or compiler marker. useWpCurrencyCurrency settings and formatPrice helper from hydrated options/defaults. formatWpPriceFormat amount with optional currency settings; defaults can use zero decimals. Not tax/discount calculation. useWpProductVariationsProduct 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 useWpCartDeclared WpCartContextType; runtime depends on whether provider context exists. WpCartContextNullable cart context. Provider/runtime shape mismatch remains open. fetchStoreApiStore API request helper with credentials and nonce handling; throws on unsuccessful HTTP. mapStoreApiToCartStateStore API response to the older provider CartState, including minor-unit amounts. useWpCheckoutShipping/gateway data, processOrder, submission state and error; custom endpoint does not process payments. useWpCustomerCustomer display/cache, account actions, orders/downloads and refresh actions; current logout integration is incomplete. useWpProductFiltersURL-backed filter state and setters; not automatic catalog refetch. useWpWishlistProduct IDs and optimistic local/attempted remote synchronization. useWpProductReviewsProduct 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.
Public types
Area Exports Products ProductType, ProductDimensions, ProductVariation, ProductAttributeOption, ProductAttribute, ProductDownload, ProductReview, WooCommerceProduct, UseWpProductsParamsTaxonomies WpProductCategory, WpProductTagProvider cart CartItem, CartTotals, CartStateStandalone/cart contract WpCartLineItem, WpCartState, WpCartContextTypeCheckout ShippingMethod, PaymentGatewayCustomer CustomerProfile, OrderRecord, CustomerDownloadRecordFilters and prices ActiveFiltersState, WpCurrencySettingsVariations UseWpProductVariationsReturnReviews SubmitReviewParams, ReviewSortOption, UseWpProductReviewsOptions, UseWpProductReviewsReturnComponent 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.